The doc here
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#No_binding_of_arguments
says Arrow functions do not have their own arguments object.
So it should be undefined when we use it in an arrow function.
But I got different results between nodejs console
and the browser
(Firefox Developer 70.0b2).
I searched the Internet, but cannot find official doc for this.
let arrowFun = () => {
console.log(arguments);
};
arrowFun("a", "b", "c");
- In Nodejs console, I expect the output to be undefined, but the actual output is:
[Arguments] {
'0': {},
'1':
{ [Function: require]
resolve: { [Function: resolve] paths: [Function: paths] },
main:
Module {
id: '.',
exports: {},
parent: null,
filename: 'e:\\workspace\\firefox-webide-test\\test\\app.js',
... omitted for brevity ...
}
- In browser, I got the right output: undefined