Write Higher Order Arrow Functions (Stuck!)

Tell us what’s happening:
I sort of understand what I need to do, conceptually, to get through this problem. But, I am not sure how to accomplish it in practice. The task I am failing is " squaredIntegers should be [16, 1764, 36]". Any help on how to approach this problem, without being given the direct answer, would be great. Thanks, in advance!

Your code so far


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(realNumberArray => realNumberArray.isInteger === true)
  .map(realNumberArray => Math.sqrt(squaredIntegers));
  // change code above this line
  return squaredIntegers;
};
// test your code
const squaredIntegers = squareList(realNumberArray);
console.log(squaredIntegers);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/write-higher-order-arrow-functions

Check the documentation of how Number.isInteger is used.

You got the right idea, unfortunately the syntax is “a bit off”, making your filter function eliminating all the values :slight_smile:

Hope this helps :+1:

You may want to avoid using the name of an existing variable for the parameters inside the callback functions, it seems unnecessary confusing

Yes it, definitely did! Changed my syntax and it helped me find out the answer. Thank you!

Makes sense. Changed it to “arr” instead of the specific variable itself and that helped me see things more clearly. Thanks!

well, it is not the whole array, it is an element of the array. Often I see just e or el used as parameter names