So I am stuck on this task and I am losing my mind. Please someone point me in the right direction. I’ve watched countless YT videos and read my 4 JS books and still I can not crack it so I am at the point where I need to ask for help.
So please help.
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;
const filterTheArray = realNumberArray.filter(
i => i > 0 && Math.floor(i) == i && Math.ceil(i) == i
);
console.log(filterTheArray);
const squaredNumber = filterTheArray.map((i) => i ** 2);
console.log(squaredNumber);
// 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_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/write-higher-order-arrow-functions/