-
Notifications
You must be signed in to change notification settings - Fork 1
08. Prototypes and Inheritance
idavidov13 edited this page Feb 13, 2024
·
2 revisions
- Enumerable - can access all of them using a for…in loop
Enumerable properties are returned using Object.keys method
- Configurable - can modify the behavior of the property
You can delete only configurable properties
- Writable - can modify their values and update a property just by assigning a new value to it
- Value
- Internally called proto in browsers and NodeJS
- Properties lookup follows the prototype chain
- Objects are not separate and disconnected, but linked
- When instantiated – a copy from class to instance
- When inherited – a copy from parent to child
- Composition should be preferred whenever possible!
- Child class inherits data + methods from its parent
- Add properties (data)
- Add / replace methods
- Add / replace access properties