var arr = [4, 5, 7, 8, 14, 45, 76]; function even(a) { var ar = []; for (var i = 0; i < a.length; i++) { ar.push(a[2 * i + 1]); } return ar; } ale
You need to test the elements for evenness like this:
var arr = [4,5,7,8,14,45,76]; function even(a){ var ar = []; for (var i=0; i
%2 is the modulo operator, it returns the remainder of integer division.