Cant complete the challenge with correct code

Tell us what’s happening:
It tells me to use map,filter or reduce. I dont see the problem in my code.

Your code so far


const squareList = (arr) => {
// Only change code below this line
return arr
        .filter(current => current > 0 && current % 1 === 0)
        .map(current => current * current);
// Only change code above this line
};

const squaredIntegers = squareList([-3, 4.8, 5, 3, -3.2]);
console.log(squaredIntegers);


Challenge: Use Higher-Order Functions map, filter, or reduce to Solve a Complex Problem

Link to the challenge:

Hi @ilearn!

Welcome to the forum!

Try placing the code all in one line. I had the same issues when I did this challenge. It works when the code is all in one line.

1 Like