Help me with my code

I can’t find where I’m wrong. Please help me.

  **Your code so far**

const squareList = arr => {
// Only change code below this line
arr.filter(num => num% parseInt(num) ===0 && num > 0);
arr.map(num => Math.pow(num,2));
return arr;
// 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/90.0.4430.212 Safari/537.36

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

Link to the challenge:

you are not changing arr, both map and filter return a new array, they do not change the array they are used on

2 Likes

Ah ! Now I see why. Thank you so much for the clarification. :grin:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.