true
or false
? That is the question...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
In JS, all functions have access to the internal arguments
array that holds all arguments that were passed into the function.
We can access the elements of this array by index, thus expecting that both regularFunction
and arrowFunction
will return true.
The only issue is that arrow functions don’t have access to the arguments
array.
There might be two separate outcomes in line 8. Most likely you’ll see the message ReferenceError: arguments is not defined
. However, there also might be a different scenario. For example, if you run this code in Node.js, arguments[2]
is likely to be evaluated to something like
Module {
id: '.',
path: '/workdir_path',
exports: {},
parent: null,
filename: '/workdir_path/scriptName.js',
loaded: false,
children: [],
paths: [
'/node_modules'
]
}
In which case, we’ll see false
logged to the screen as 3
is not equal to the object described above.
ANSWER: false
or ReferenceError
will appear in the console depending on the execution environment
Top comments (0)