Write Higher Order Arrow Functions - function keyword not used?

Tell us what’s happening:

I had gotten every other requirement right, except the “function keyword was not used.” one. Not getting it. I had even
used it in my code. What am I doing wrongly?

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 = realNumberArray.filter(function(number){
  //  if(number % 1 == 0 && number >0){
  //    return number*number;
  //  }

  const squaredIntegers_pre = realNumberArray.filter(number => number % 1 == 0 && number >0);
  const squaredIntegers = squaredIntegers_pre.map(function(num1){
    return num1 * num1;

  // change code above this line
  return squaredIntegers;
// test your code
const squaredIntegers = squareList(realNumberArray);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:

The exercise is expecting you to use ES6 syntax. Therefore passing in

    return num1 * num1;

as a callback in your map won’t work. Use the syntax like you used on filter. :sunglasses:

1 Like

In addition to what @shimphillip mentions, there is a slight bug in the test which is picking up your commented code which also has the word function in it. Get rid of that commented code also or it will not pass either.


@shimphillip @RandellDawson This worked! Thanks! :smiley:

1 Like

I was flagged… why?

It would have been so much more clear for me if the requirement was: function keyword must not be used. I thought I was wrong for not having used the function keyword…
And warming up to ES6 syntax in this early stage of the course is rough when combined with brushing up on higher order functions, method chaining and using Math… or not, using isInteger or not…