Write Higher Order Arrow Functions Improvement

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);

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:

You can chain your array method like this

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

1 Like

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?