Extending built-in classes thumbnail
Extending built-in classes
javascript.info
But built-in classes are an exception. They don’t inherit statics from each other. Built-in classes like Array, Map and others are extendable also. When arr.filter() is called, it internally creates the new array of results using exactly arr.constructor, not basic Array Other collections, such as Ma
2 Users
0 Comments
12 Highlights
0 Notes

Top Highlights

  • But built-in classes are an exception. They don’t inherit statics from each other.
  • Built-in classes like Array, Map and others are extendable also.
  • When arr.filter() is called, it internally creates the new array of results using exactly arr.constructor, not basic Array
  • Other collections, such as Map and Set, work alike. They also use Symbol.species.
  • Symbol.species to the class. If it exists, it should return the constructor that JavaScript will use internally to create new entities in map, filter and so on.

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.