Challenge Will Not Accept Correct Answer

Tell us what’s happening:
I believe the solution below is correct, but the test for

image

is not passing. I even copy-pasted the solution from the hints and it still rejected the answer.

Any suggestions as to how to get this to pass?

Your code so far


const squareList = (arr) => {
// Only change code below this line
return arr
  .filter(item => item>0 && Math.floor(item) == item)
  .map(item => item*item);
// 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 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36.

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

Link to the challenge:

Just remove the spacing before .filter and .map. The tests are not clever enough to compensate for the nice, tidy alignment that you are doing.

Thank you! I just made it a single line and it worked.

I’m glad I could help. Happy coding!