Today I Learned

hashrocket A Hashrocket project

`arguments` is not available in an arrow function

In a function, the arguments object is an available local variable, demonstrated thusly:

> function normalFn() {console.log(arguments)}
> normalFn()
> normalFn(1)
{ '0': 1 }

But arrow functions don't get the arguments object:

> const arrowFn = () => {console.log(arguments)}
> arrowFn()
ReferenceError: arguments is not defined

Read more here

H/T Thomas Allen

See More #javascript TILs
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.