# Write Higher Order Arrow Functions!?

Write Higher Order Arrow Functions!?
0

#1

So here’s the thing: before this challenge, I never found anything about map() and filter(), so I didn’t have a clue of how to solve this. I think there should be challenges for map(), filter() and reduce() before this one.

After seeing the solution, I still don’t understand the syntax of any of the three fuctions or the arrow functions. Also, how does the const keyword not give an error when you declare it again? And how do the filter and map functions know that “num” is each value of the array? Very confused. Pls 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.filter((num) => (num%1 == 0) && (num > 0)).map( (num) => Math.pow(num, 2));
// change code above this line
return squaredIntegers;
};
const squaredIntegers = squareList(realNumberArray);
console.log(squaredIntegers);
``````

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`.

#2

Your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution.

Thank you.

#3

#4

This one threw me for a loop too. I understand the value of googling things I don’t know, but I agree that I would have been better off with a section just for those three.