Last active
August 22, 2018 01:26
-
-
Save NathanKleekamp/bc936d29b966951c2a14a9bd0e7387a4 to your computer and use it in GitHub Desktop.
Last item from an array utility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const last = array => array.slice(-1); | |
const testArray = [0, 1, 2, 3]; | |
last(testArray); // [3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment