Hi everyone,
Just completed the challenge on this one - https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem
My code below passes the challenge; however, I’d like to know if I can modify anything to make the code neater. Any advice will be appreciated Thanks for reading!
const squareList = arr => {
// Only change code below this line
return arr
.filter(num => Number.isInteger(num) && num > 0)
.map(num => num*num)
// Only change code above this line
};
const squaredIntegers = squareList([-3, 4.8, 5, 3, -3.2]);
console.log(squaredIntegers);