Tell us what’s happening:
Hi everyone,
My code below did not passed all the tests. I had an error for the test:
map
,filter
, orreduce
should be used.
But I used a combination of map
and filter
, so I don’t understand what happened.
Maybe a bug ? Or perhaps I misused Number.isInteger
?
Any feedback is welcome
Your code so far
const squareList = (arr) => {
// Only change code below this line
return arr
.filter(x => Number.isInteger(x) && x > 0)
.map(x => x * x );
// Only change code above this line
};
const squaredIntegers = squareList([4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2]);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:81.0) Gecko/20100101 Firefox/81.0
.
Challenge: Use Higher-Order Functions map, filter, or reduce to Solve a Complex Problem
Link to the challenge: