Pretty sure..... I got it, but

Tell us what’s happening:

did I do something wrong? I’m kinda? sure that I’ve passed the test? but it won’t let me move on.

map , filter , “orreduce should be used.
the instruction uses the word or, instead of and. I’m pretty sure that it means that I can freely use any of them instead of need to use all 3

Your code so far


const squareList = (arr) => {
// Only change code below this line
return arr
.filter(num=>num>0 && Number.isInteger(num))
.map(num=>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 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 OPR/71.0.3770.228.

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

Link to the challenge:

remove the spaces between arr and .filter and also .map
Leave them on one line, instead of multiple lines

1 Like