The example given for Arrow Function has No Prototype Property isn't correct.
The problem with arrow functions (actually one of it's feature) is it always has the same this, as a result you can't use it as a method because this will always be the this from the context you defined the function (eg. window).
You're pointing out that Meal.prototype will be undefined after defining .eat as an arrow function. that's not correct.
The example given for
Arrow Function has No Prototype Property
isn't correct.The problem with arrow functions (actually one of it's feature) is it always has the same
this
, as a result you can't use it as a method because this will always be thethis
from the context you defined the function (eg. window).You're pointing out that
Meal.prototype
will be undefined after defining.eat
as an arrow function. that's not correct.Here's an example that explains the problem:
i.imgur.com/NwDHYYr.png
As you can see, the arrow function doesn't know about
this.food
.