Skip to content

Instantly share code, notes, and snippets.

@chipoglesby
Last active March 5, 2016 00:03
Show Gist options
  • Select an option

  • Save chipoglesby/f9910a5b3a723cfda3ea to your computer and use it in GitHub Desktop.

Select an option

Save chipoglesby/f9910a5b3a723cfda3ea to your computer and use it in GitHub Desktop.
This loops over the indices of the first array, and uses that to index into the others.
function loopMultipleArrays() {
var a = ["a","b","c"];
var b = ["A","B","C"];
var c = [1,2,3];
output = "";
var i;
for (i = 0; i < a.length; i += 1) {
output += a[i] + b[i] + c[i] + "\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment