Created
August 1, 2012 22:42
-
-
Save duncanmcdougall/3231354 to your computer and use it in GitHub Desktop.
Insert item to start of JavaScript array
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
var fruit = ["apple", "banana", "coconut"]; | |
fruit.reverse().push("melon"); | |
fruit.reverse(); | |
//fruit array should now be ["melon", "apple", "banana", "coconut"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment