JS prototypes Flashcards
What kind of inheritance does the JavaScript programming language use?
prototypal inheritance: an object “inherits” properties from another object via the prototype linkage.
What is a prototype in JavaScript?
- object that objects that can build off of
- Prototypes are the mechanism by which JavaScript objects inherit features from one another.
How is it possible to call methods on strings, arrays, and numbers even though those methods don’t actually exist on objects, arrays, and numbers?
objects can have a prototype object, which acts as a template object that it inherits methods and properties from.
grabbing from prototypes
If an object does not have it’s own property or method by a given key, where does JavaScript look for it?
on the prototypes