arrow function
(ES6) a new form of function expression.
Last updated
Was this helpful?
(ES6) a new form of function expression.
Last updated
Was this helpful?
⟩ ⟩ ⟩ arrow function
⭐️ ES6 (2015):a new form of function expression.
when the { ... }
are omitted, a return value is sent out without using return.
doesn’t have own bindings to , or .
⭐️ arrow function as method❗️ (❗️use with caution❗️)
normally, you don't use arrow functions as , but if you have:
an object A that has a method returning a new object B,
object B has its own methods,
you don't want this in these methods to refer to B but refer to A instead,
then using arrow functions as methods is an option.
👉 see example: Sequence
aren't suitable for , and methods, which generally rely on establishing a .
don't have access to new.target keyword.
can’t be used as . (can’t be called with new)
can’t use , within its body.
deplicate parameters Early Error rule (🚧) is always applied to arrow function definition even if 'strict mode' (🚧) is not defined explicitly.
arr.containsSubarray() - used in .