Created
September 3, 2016 16:41
-
-
Save jasonbellamy/7df148cd7e53424229a0822c4692c704 to your computer and use it in GitHub Desktop.
Get the value of the last item in an array using the arrays .reverse() method
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 xs = [1, 2, 3, 4, 5]; | |
const x = xs.reverse().shift() //=> 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment