Skip to content

Instantly share code, notes, and snippets.

@DavidMellul
Last active March 10, 2018 13:27
Show Gist options
  • Save DavidMellul/527c64e712d32acdc878735fc6ed20cd to your computer and use it in GitHub Desktop.
Save DavidMellul/527c64e712d32acdc878735fc6ed20cd to your computer and use it in GitHub Desktop.
let x = [1,2,3,4,5];
let y = [];
for(let i = 0; i < x.length; i++)
if(x[i] % 2 == 0)
y.push(x[i]*2);
else
continue;
console.log(y);
// => [4,8]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment