Very detailed and I love the analogy! One thing though - you are passing a this when calling forEach etc with a fat arrow function. That doesn't do anything. Passing a this is useful when using real functions or class methods/prototypes etc.
This example illustrates it, I've commented what it logs:
Thanks for sharing your views.
Actually, I tried to use the simplest examples and focused more on explaining the parameters than actually going deep into the classes concept.
Will try to give better examples in my future articles.🙇
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Very detailed and I love the analogy! One thing though - you are passing a
this
when callingforEach
etc with a fat arrow function. That doesn't do anything. Passing athis
is useful when using real functions or class methods/prototypes etc.This example illustrates it, I've commented what it logs:
Which isn't what people often expect :)
In a fat arrow the
this
is always thethis
of the calling context.Thanks for sharing your views.
Actually, I tried to use the simplest examples and focused more on explaining the parameters than actually going deep into the classes concept.
Will try to give better examples in my future articles.🙇