hmm, what’s a way to check for a remainder?
Could you use the % ? Maybe say num % 2 === 0
Close, but num % 2 checks if a number is evenly divisible by 2.
Ahhhhhhh so I should use 1
const squareList = arr => {
// Only change code below this line
let positiveIntegersSquared = arr.filter(num => {
if (num > 0 && num % 1 === 0) return num;
}).map(num => { return num * num });
return positiveIntegersSquared;
// Only change code above this line
};
const squaredIntegers = squareList([-3, 4.8, 5, 3, -3.2]);
console.log(squaredIntegers);
Thank you so much for your patience Jeremy! Love the way you help me out without giving me the answer or obvious hints
1 Like
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.