0
when reading documentation for a language such as is, what does prototype refer too. string.prototype.toString()
Js Documentation
5 odpowiedzi
+ 2
Prototypes are the mechanism by which JavaScript objects inherit features from one another. In this article, we explain how prototype chains work and look at how the prototype property can be used to add methods to existing constructors.
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object_prototypes
+ 1
Martin Taylor, Thanks!!
0
JS is an Object Oriented Programming language...
roughly, there is two kind of implementing OOP: by classes, and by prototyping.
most of OOP languages uses classes, while JS use prototype... even in latest version where it has introduced the syntactic sugar of 'classes' (internally, that's still implemented using prototyping ;P
consider that both class and prototype based OOP define a blueprint used to build objects of same kind/family...
A good source reference to dive into the prototype specificities mechanic used in JS is the mdn site:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Details_of_the_Object_Model
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object_prototypes
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain