If we print the output of arguments variable inside a normal function:
var func = function() { console.log(arguments); }
func();
The result is an object which contains information about the context (parameter values, scope , functionLocation...)
But if we reproduce the same function with fat arrow, we will never get argument declared:
var func = () => { console.log(arguments); }
func();
// arguments is not defined
Can anyone explain how can we get the context data from arrow functions?
According to MDN
An arrow function expression has a shorter syntax than a function expression and does not have its own this, arguments, super, or new.target. These function expressions are best suited for non-method functions, and they cannot be used as constructors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With