Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Created September 26, 2012 21:52
Show Gist options
  • Save cecilemuller/3790859 to your computer and use it in GitHub Desktop.
Save cecilemuller/3790859 to your computer and use it in GitHub Desktop.
Shorthand to iterate thru an array and get the current element in a variable, in pure Javascript
var myArray = ["aaaaa", "bbbbb", "ccccc"];
for (var i = 0, oneItem; oneItem = myArray[i]; i++){
console.log( oneItem );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment