Arrow function doesn't get approved


My arrow function doesn’t get approved by JetBrains academy. I don’t understand why.

Why is the solution not accepted?

The problem seems to be on line 6 where you are passing the argument into the function. while invoking the function. There is no need to pass the parameter (a) that you have passed while defining the function above.

Okay. So I tried this code instead:

let returnNumber = (a) => {
    return 1;

console.log(returnNumber()) // 1

It doesn’t get accepted either. :frowning_face:

I offer these tips without having any idea about JetBrains Academy or its curriculum or what it’s looking for in your answer.

  • try changing let to const
  • try using the function keyword instead
  • try writing the arrow function with an implicit return
  • try to remove your console log line entirely
  • try removing the parentheses around the a parameter

If it’s looking for a specific way of writing the function rather than just testing its output, then the above may help. Otherwise, I don’t know, skip it. It looks like you understand the concept.

What about:

let returnNumber = (a) => {
    return a;

console.log(returnNumber(1)) // 1


const returnNumber = a => a;

console.log(returnNumber(1)) // 1
1 Like

= > 화살표 함수(Arrow Function) 는 작동하지 않는 것 같습니다…

Okay. So I think I have tried all suggestions from both colinthornton and RandellDawson and the Jetbrains system didn’t accept anything of it. I even created a theory that they are doing “denial of service”. :confused:

How do we access this exercise to test for ourselves?

It mentions recommending using a function expression as an arrow function? So maybe:

const returnNumber = function (n) {return n};

Though i find that an odd way of doing arrow functions when the point is to trim the syntax down.

Well what you wrote above is not an arrow function.

I already suggested a function expression as an arrow function:

const returnNumber = a => a;

but apparently that is not being accepted.

yeah i realize shortly after i posted lol.

Allright so there was an option to view solutions to the problem and move on. What the system wanted was just a function and nothing else.
So this line of code worked as a solution: let returnNumber = (a) => a;

Thanks everyone who tried to help me! :nerd_face: