Tell us what’s happening:
When I was stuck in a problem then try to get help as “Hint” and at the end the same copy and paste the code from hint section and tried to execute code again but still it’s not working.
Kindly help me to get out of this problem.
Your code so far
const squareList = (arr) => {
// Only change code below this line
const squareList = arr => {
return arr.reduce((sqrIntegers, num) => {
return Number.isInteger(num) && num > 0
? sqrIntegers.concat(num * num)
: sqrIntegers;
}, []);
};
// 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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
.
Challenge: Use Higher-Order Functions map, filter, or reduce to Solve a Complex Problem
Link to the challenge: