Arguments object throws an error when used with arrow functions.
Consider this code -
|
|
The result is as expected. But, you cannot do the same using an arrow function.
|
|
You will see a function definition, or an error depending on the runtime engine. Arrow functions do not provide the binding for arguments object like regular functions.
Just use a rest operator instead of arguments, and it works in both normal and arrow functions.
|
|