Help needed for this topic :Write Higher Order Arrow Functions

Tell us what’s happening:
I can’t seem to figure out what is going wrong with this code. I have set the squaredIntegers array to [16,1764,36] but i can’t seem to figure out where to use the filter , map or reduce function. Help would be really appreciated . Thanks.

Your code so far

const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34];
const squareList = (arr) => {
  "use strict";
  // change code below this line
  const squaredIntegers = [16,1764,36];
  // change code above this line
  return squaredIntegers;
// test your code
const squaredIntegers = squareList(realNumberArray);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36.

Link to the challenge:

Eheh man, you can’t just write the solution in plain text and expect to pass the challenge :stuck_out_tongue:
What you’re supposed to do is to use high order function ( i.e. filter, map, reduce ) to obtain the result you wrote.

How to do that? Well, to summarize the challenge instructions you have to do two operation:

  • Check for each element of the array passed as argument to the squareList function if it is an integer
  • Return the square of each integer

Using those HOF could help :slight_smile:

Oh Ok… yea that’s true

Well i got it just now and pass the challenge. Thanks for the help anyways.

1 Like