function filterEvenElements(arr) {
for (var i = 0; i < arr.length; i++) {
var newArr = [];
if (arr[i] % 2 !== 0) {
newArr.push(arr[i]);
}
return newArr;
}
console.log(newArr);
}
var output = filterEvenElements([2, 3, 4, 5, 6]);
console.log(output); // --> [2, 4, 6]
when I return I return newArr
it's just an empty array? Why is this? I cannot figure it out