Functional Programming: Use Higher-Order Functions map, filter, or reduce to Solve a Complex Problem:
In this challenge, I cannot submit my code. Test says " map, filter or reduce should be used".
I’m definitely using map and filter, and the code works for all cases. I still checked for the hints and solutions, copied one of them (which used all three methods above) and still didn’t pass. So my code is not a problem. It just can’t be submitted and I have no clue why.
(I skipped and continued other challenges, i’m already on the js projects but this challenge is still not passed).
I don’t need any code explanations, I’m just looking for a way to submit and see 24/24 done, not 23/24. What do I do?
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 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36
.
Challenge: Use Higher-Order Functions map, filter, or reduce to Solve a Complex Problem
Link to the challenge: