Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Car = {
- wheel_count: 4,
- noise: "skur skuuuuur",
- rapAboutIt() {
- return `I love my ${this.brand.name} ${this.model}. I'm ridding in the city like ${this.noise}...`
- }
- } // the parent
- my_car = {
- model: "Civic Type R",
- brand: {name: "Honda", fonded: 1948}
- } // the child
- Object.setPrototypeOf(my_car, Car)
- // way to make my_car inherit from Car
- my_car.wheel_count
- // expects: 4
- my_car.rapAboutIt()
- // expects: "I love my Honda Civic Type R. I'm ridding in the city like skur skuuuuur..."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement