Write Higher Order Arrow Functions Improvement

Write Higher Order Arrow Functions Improvement
0

#1

Tell us what’s happening:

So its Working but how can I improve it more?

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 b= arr.filter((a) => a>0 && (a%2==0 || a%2==1) )
  return b.map((c)=>c**2)
};
// 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_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36.

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


#2

You can chain your array method like this

return arr.filter((a) => a>0 && (a%2==0 || a%2==1) ).map((c)=>c**2);


#3

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.

“Improve” is a subjective terms. What does improve mean to you?