Skip to content

Instantly share code, notes, and snippets.

@javanigus
Last active January 11, 2018 21:29
Show Gist options
  • Save javanigus/fbf0881ebb76323e18d6bbd38b53a4bd to your computer and use it in GitHub Desktop.
Save javanigus/fbf0881ebb76323e18d6bbd38b53a4bd to your computer and use it in GitHub Desktop.
Example JavaScript For Loop
// INPUT
let numbers = [1, 2, 3, 4];
// MULTIPLY EACH ARRAY ITEM BY 2
for (let i=0; i<numbers.length; i++) {
results.push(numbers[i]*2);
}
// OUTPUT
// [2, 4, 6, 8]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment