Class inheritance thumbnail
Class inheritance
javascript.info
Class inheritance is a way for one class to extend another class. Internally, extends keyword works using the good old prototype mechanics. It sets Rabbit.prototype.[[Prototype]] to Animal.prototype. So, if a method is not found in Rabbit.prototype, JavaScript takes it from Animal.prototype. Classes
6 Users
0 Comments
75 Highlights
0 Notes

Top Highlights

  • Class inheritance is a way for one class to extend another class.
  • Internally, extends keyword works using the good old prototype mechanics. It sets Rabbit.prototype.[[Prototype]] to Animal.prototype. So, if a method is not found in Rabbit.prototype, JavaScript takes it from Animal.prototype.
  • Classes provide "super" keyword for that.
  • super.method(...) to call a parent method.
  • Arrow functions have no super

Tags

Javascript

Ready to highlight and find good content?

Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.