put image here or so and whats
This Page covers
Inheritance
- (...i forgot), then
- classe inheritance thing i forgot
- and something else
Here is example code to fix format of
class Dog {
bark(){
return 'barking'
}
}
const fido = new Dog()
fido
- fido doesn't have a bark method directly on it.
- Instead, fido.__proto__ (or Object.getPrototypeOf(fido)) points to Dog.prototype, where bark lives.
- So fido.bark() works because JavaScript looks up the prototype chain and finds it there.
⛓️ Think of It Like a Chain When you call a method on an object:
- JS looks on the object itself.
- If it doesn't find it, it goes to the object's prototype.
- If still not found, it keeps going up the chain until it hits null.
So you're not seeing methods directly on instances because they're not there — they're on the prototype.
We use promises when we need to wait for information or data