Write Higher Order Arrow Functions - issue with syntax

Tell us what’s happening:

I remove return it still reports issues, maybe i’m still having dificulties understanding the syntax?

SyntaxError: unknown: Unexpected token (6:2)
4 | // change code below this line
5 | const squaredIntegers = number.filter((number)=>

6 | return number.isInteger(number)?number: false;
| ^
7 | let result = number.map(function(){
8 | return number;
9 | });

Your code so far


const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2];
const squareList = (arr) => {
  "use strict";
  // change code below this line
  const squaredIntegers = number.filter((number)=>
  return number.isInteger(number)?number: false;
  let result = number.map(function(){
    return number;
  });

  // 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_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36.

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

number is not defined, maybe there is already a variable you should use here


number.isInteger() is not a function
I suggest checking the syntax for isInteger():


You are missing the closing round parenthesis. Also, you can’t use arrow syntax like that, if you want to use implicit return without the curly brackets around the body of the function that you can’t use the return keyword as that is implicit in the arrow syntax. If you need something more complex you need to surround the body of the function in curly brackets and use the return keyword

const func = x => value; // fine
const func = x => return value; // not fine, unexpected token error.
const func = x => {return value}; // fine