Skip to content

Instantly share code, notes, and snippets.

@avand
Created September 30, 2016 16:11
Show Gist options
  • Save avand/de4fbacf9b27bad175e9c34dbf116aff to your computer and use it in GitHub Desktop.
Save avand/de4fbacf9b27bad175e9c34dbf116aff to your computer and use it in GitHub Desktop.
// This is a string... (looks like a list but still a string)
var animalsString = "cow,dog,horse,moose,rooster";
// Turn the string into an array...
var animalsArray = animalsString.split(",");
// Now you can go about looping, like normal...
for (var i = 0; i < animalsArray.length; i++) {
// animalsArray[i]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment