🚧 under construction
JS ⟩ objects ⟩ arrow function ⟩ as method
⭐️ ❗️use with caution❗️
normally, you don't use arrow functions as methodsarrow-up-right, 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 function as method is an option.
👉 see example: Sequence
Sequence - an iterable of numbers, whose iterator uses arrow functions as methods.
arrow function as class field❗️
JS.info ⟩ arrow functions revisitedarrow-up-right
arrow functions used as methodsarrow-up-right ⭐️
Methodarrow-up-right
Methods in ES6 objects: using arrow functionsarrow-up-right
Last updated 3 years ago