Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. Car = {
  2. wheel_count: 4,
  3. noise: "skur skuuuuur",
  4. rapAboutIt() {
  5. return `I love my ${this.brand.name} ${this.model}. I'm ridding in the city like ${this.noise}...`
  6. }
  7. } // the parent
  8. my_car = {
  9. model: "Civic Type R",
  10. brand: {name: "Honda", fonded: 1948}
  11. } // the child
  12. Object.setPrototypeOf(my_car, Car)
  13. // way to make my_car inherit from Car
  14. my_car.wheel_count
  15. // expects: 4
  16. my_car.rapAboutIt()
  17. // 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