Skip to content

Instantly share code, notes, and snippets.

@NathanKleekamp
Last active August 22, 2018 01:26
Show Gist options
  • Save NathanKleekamp/bc936d29b966951c2a14a9bd0e7387a4 to your computer and use it in GitHub Desktop.
Save NathanKleekamp/bc936d29b966951c2a14a9bd0e7387a4 to your computer and use it in GitHub Desktop.
Last item from an array utility
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