Couldn't pass map filter reducer

Tell us what’s happening:
For this question, I have tried the hint but still doesn’t work. Please help.

Your code so far


const squareList = (arr) => {
// Only change code below this line
return arr
    .filter(num => num > 0 && num % parseInt(num) === 0)
    .map(num => Math.pow(num, 2));
// Only change code above this line
};

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.80 Safari/537.36.

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

Link to the challenge:

return arr.filter(num => num > 0 && num % parseInt(num) === 0).map(num => Math.pow(num, 2)); Hey, you should get together the arr with .filter

1 Like

Wow! thank you! should I always put .filter after arr? any difference between put it together and the next line?

No difference, it’s just how fcc test scripts are written, in an IDE, you won’t find this error.

1 Like