🔰arrow function
(ES6) a new form of function expression.
JS ⟩ value ⟩ function ⟩ arrow function
⭐️ ES6 (2015):a new form of function expression.
when the { ... }
are omitted, a return value is sent out without using return.
⭐️ arrow function as method❗️ (❗️use with caution❗️)
normally, you don't use arrow functions as methods, 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
don't have access to new.target keyword.
can’t be used as constructors. (can’t be called with new)
can’t use
yield
, within its body.
deplicate parameters Early Error rule (🚧) is always applied to arrow function definition even if 'strict mode' (🚧) is not defined explicitly.
Last updated