Created
November 26, 2013 01:35
-
-
Save nola/7652078 to your computer and use it in GitHub Desktop.
Useful way of declaring small arrays on one line.
Object Array Notation Shorthand
This file contains hidden or 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 a = new Array(); | |
a[0] = "myString1"; | |
a[1] = "myString2"; | |
a[2] = "myString3"; | |
//short hand version | |
var a = ["myString1", "myString2", "myString3"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment