Write Higher Order Arrow Functions Function Key word was not used error

Tell us what’s happening:
Hello reviewing my challenge progression I found that I didn’t pass this challenge so I tried to write the code for and I can’t pass the challenge it shows me an error saying that function keyword was not used and if I print the output I have the good values. It is the only one why I’m not validating so here is my code did I miss something

Your code so far

const squareList = (arr) => {
  "use strict";
  // change code below this line
  const squaredIntegers = arr.filter(
      return Number.isInteger(elt) && elt > 0;
        return elt*elt;
  // change code above this line
  return squaredIntegers;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0.

Link to the challenge:

The error message is a little confusing. It says function keyword was not used but that is just the test that was failing, in this challenge you should not use the function keyword.

It wants you to use the ES6 arrow function instead of declaring the function as a function…im sorry I don’t know how to explain it very well.

But the instructions on the left explains what it wants, re-read the instructions on the challenge carefully and see if that helps

Read the following code:

FBPosts.filter(function(post) {
  return post.thumbnail !== null && post.shares > 100 && post.likes > 500;


We have written this with filter() to at least make it somewhat readable. Now compare it to the following code which uses arrow function syntax instead:

FBPosts.filter((post) => post.thumbnail !== null && post.shares > 100 && post.likes > 500)


It was my first approach without function declaration this way

const squaredIntegers = arr.filter( (elt) => {
      return Number.isInteger(elt) && elt > 0;
    }).map((elt) => {
        return elt*elt;

but it didn’t work that why I used function keyword
I even tried this with the map function

.map(elt => elt*elt);

but nothing. So I tried the solution proposed by the side even the solution doesn’t work.

That looks correct. Did it pass the tests, or what error is it showing now?

I edit my last post check it. It’s showing the same error

I copied the function you have and it passed all the tests.

Can you paste your full code.

I reload the test and it passed. Thanks I should have thought about it

1 Like