Write Higher Order Arrow Functions not understanding

Write Higher Order Arrow Functions not understanding
0.0 0


Tell us what’s happening:
so i’m suppose to get square of positive integer in “realNumberArray” and then store it in a new variable but i have no idea how to do it or what to use. The example given is completely different from it .

Your browser information:

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

Link to the challenge:


usually my method of solving algorithmic challenges is to initially write down a solution that works for a human being to solve. That is, if you want to explain how to do this to someone else (a person) , what are the steps you would write?

Maybe something like:

look through this given array
if a number is not a positive integer, ignore it
otherwise square it
put the new squared number in a new list

Or something like that right?

Now that you have the description , try to translate it to code. Do you know any code that can help ? If not , can googling javascript functions that do certain things (like check if a number is an integer) help?

Let us know if you need more help.

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 = arr;
  arr.filter(if )
  // change code above this line
  return squaredIntegers;
// test your code
const squaredIntegers = squareList(realNumberArray);

so im filtering the “arr”. Do i use if else statements here? like if the values inside of arrays is greater than 0 meaning if its positive then store it in “squaredIntegers” variable this is the best idea i have and i doubt it would work :(. Please help


good start. Filter is a function that takes another function and applies it to the array and returns the resulting array of items.

So how do you give filter what it wants? It wants a function…

hope this helps