Write Higher Order Arrow Functions help

Tell us what’s happening:
would there be a possibility for this code to work as a solution too?
i am not entirely sure how to make it work, but i think it should

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 = (arr.filter(integer =>  Number.isInteger(arr) && arr > 0)).map( squared => Math.pow(integer,2));

  // 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.11; rv:69.0) Gecko/20100101 Firefox/69.0.

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

your using the functions right but you just have things in the wrong places, this is how it should be

const squaredIntegers = arr.filter(integer => Number.isInteger(integer) && integer > 0).map( squared => Math.pow(squared,2))

Hey thank you for the prompt reply, i have tried that code and it is not working still, SyntaxError: missing ) after argument list that is what I get. So i am not sure where its wrong.

have you tried resetting the code first? the code defo works

or maybe you only had one ) at the end instead of 2?

Hey thanks for the patience and the help, for some reason it was not working yesterday. I spent a few more hours trying to do it like that and today it just worked.
I am not really sure what is the difference but it does work.

regards
Jose

1 Like

yeah it can start getting confusing when stringing multiple functions together especially when first starting arrow functions.

1 Like

Thank you for your response, now i also know how to use the night mode.

regards.

1 Like