console.log(f(10, 30))let f = (a, b) => a + b;
In this question, we have a
console.log as the first statement and calling
30 as arguments.
The next line declares an arrow function (
=>), which adds the parameters together. Let's work together to find the right answer.
In the first line we're calling function
f even before it was declared, it is in the next line that we have declared a variable called
which refers to an arrow function. This arrow function has two parameters,
b, and return addition of
Since we are declaring an arrow function and not the function declaration syntax, there will be no hoisting performed when the code executes
and therefore the
ReferenceError will be the error as the output, which is the correct answer. Let's run the code in the IDE to prove that.
Over here, as we hit run, we can see that the "
f is not defined" is the correct answer.