---
title: "190509-TIL"
date: 2019-05-09
tags: ["TIL"]
url: https://sub2n.github.io/2019/05/09/190509-TIL/
---

# 190509-TIL

## Today I Learned

-   Implemented underscore libray’s last function
    
    ![Condition complete](https://user-images.githubusercontent.com/48080762/57434410-e332ad00-7275-11e9-9c6f-2c85032b12d2.png)
    
    ```js
    // Like first, but for the last elements. If n is undefined, return just the
    // last element.
    _.last = function(array, n) {
      return n === undefined ? array[array.length-1] : n > array.length ? array : array.slice(array.length-n, array.length);
    };
    ```
    
-   Studied about JavaScript global variable and let, const keyword variables.