Skip to content

Instantly share code, notes, and snippets.

@jasonbellamy
Created September 3, 2016 16:31
Show Gist options
  • Save jasonbellamy/5c40b8f28237c1a88f1409e82e98aa51 to your computer and use it in GitHub Desktop.
Save jasonbellamy/5c40b8f28237c1a88f1409e82e98aa51 to your computer and use it in GitHub Desktop.
Get the value of the last item in an array using the arrays .reverse() method
const xs = [1, 2, 3, 4, 5];
const [ x ] = xs.reverse() //=> 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment