Created
February 23, 2012 23:20
-
-
Save jescalan/1895661 to your computer and use it in GitHub Desktop.
Intro to arrays
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
| // here's an array | |
| arr = [] | |
| // here's some shit in an array | |
| arr = ['some', 'shit'] | |
| // here's adding some shit to an array | |
| arr.push('more shit') | |
| // here's counting the number of things in an array | |
| arr.length | |
| // here's getting something back out | |
| console.log(arr[0]) // => some | |
| // here's printing each item in an array | |
| for(i=0;i<arr.length;i++){ | |
| arr[i] | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment