Write Higher Order Arrow Functions using map

Tell us what’s happening:

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.map(arr=>Number.isInteger(arr)&&return arr*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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36.

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

Was there a questions?

One problem I see right away is that:

const squaredIntegers = arr.map(arr=>Number.isInteger(arr)&&return arr*arr);

there should be no return in that line. There is an implicit return because this is an inline arrow function.

If you fix that, you still have a problem in that you are generating false for the non-integer data. Look at the expected output. You need to rethink what you’re doing here.

A quick hint: One obvious solution would be to use two higher order functions, maybe chaining them.