Skip to content

Instantly share code, notes, and snippets.

@jescalan
Created February 23, 2012 23:20
Show Gist options
  • Select an option

  • Save jescalan/1895661 to your computer and use it in GitHub Desktop.

Select an option

Save jescalan/1895661 to your computer and use it in GitHub Desktop.
Intro to arrays
// 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