Given an array in JavaScript, I would like to select only the elements that are even. For example
array = [1,2,3,4,5,6,7,8,9,10]
It would return
[2,4,6,8,10]
Here is my code
array = [1,2,3,4,5,6,7,8,9,10]
for (i = 0; i < array.length; i++) {
  newArray = [];
  if (i[0] % 2 == 0 {
    newArray.push(i)
   return newArray;}}
=> Illegal return statement
I have no idea what I'm doing wrong, but any help would be appreciated. Thank you.
 
     
     
    