Higher order of arrow - stuck

Higher order of arrow - stuck
0

#1

I’m stuck for whole day. Am I completely wrong or a little bit?

const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2];
const squareList = (arr) => {
  "use strict";
  // change code below this line
  const squaredIntegers =  realNumberArray.map(Math.sqrt).filter(numb => numb > 0 && Number.isInteger(arr));
  // change code above this line
  return squaredIntegers;
};
// test your code
const squaredIntegers = squareList(realNumberArray);
console.log(squaredIntegers);

#2

I think you should filter your array first before mapping it. Also, you’re supposed to find the square and not the square root. And you’re checking for the wrong thing in the Number.isInteger

Hope this helps, good Luck :wink:


#3

Thx, man. I wasn’t sure about this undeclared “numb” part and now it worked.

const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2];
const squareList = (arr) => {
  "use strict";
  // change code below this line
  const squaredIntegers =  realNumberArray.filter(numb => numb > 0 && Number.isInteger(numb)).map(numb => numb *numb);
  // change code above this line
  return squaredIntegers;
};
// test your code
const squaredIntegers = squareList(realNumberArray);
console.log(squaredIntegers);