Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Maria Dan
Added: May 11, 2021 4:40 PM
Modified: May 12, 2021 4:41 PM
Views: 472
Tags: no tags
  1. let animal = {
  2.     eyes: "two",
  3.     tail: true
  4. }
  5.  
  6. let cat = {
  7.     name: "Kot",
  8.     makeSound () {
  9.         alert(this.name)
  10.     }
  11. }
  12.  
  13. let wildCat = {
  14.     breed: "wild"
  15. }
  16.  
  17. cat.__proto__ = animal
  18. wildCat.__proto__ = cat
  19.  
  20. console.log(wildCat)
  21. for (let prop in wildCat) {
  22.     if (wildCat.hasOwnProperty(prop) == true) {
  23.         console.log(prop)
  24.     }
  25. }