Skip to content

Instantly share code, notes, and snippets.

@olddustysocksunderthecouch
Created May 7, 2018 11:40
Show Gist options
  • Save olddustysocksunderthecouch/b53dad030a817422ac5212df3b392706 to your computer and use it in GitHub Desktop.
Save olddustysocksunderthecouch/b53dad030a817422ac5212df3b392706 to your computer and use it in GitHub Desktop.
let arr = [1, 2, 3, 4, 5, 6];
let even = [];
for(var i = 0; i < arr.length; i++) {
if (arr[i] % 2 === 0) even.push(arr[i]);
}
// Result: even = [2,4,6]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment