Write Higher Order Arrow Functions - i need help

Write Higher Order Arrow Functions - i need help
0

#1

Tell us what’s happening:

i really don’t understand what i am supposed to do here

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 = arr.filter((arr) =>  );
  // 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

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


#2

First, you should filter the array by only positive integers. Then you should square each value in the filtered array and return that array. hint: use map method.


#3

Filter is going to pass your inner function the values in the array one by one. Then in the function given to filter, some kind of logical comparison may need to happen. The logical comparison produces a true or false. You are supposed to return a boolean and based on this filter will either keep the currect value or discard it.

arr.filter( (item) => item === ‘hbar1st’);

Eg This is a filter for an array that returns only things that equal the string ‘hbar1st’