Guest User

Untitled

a guest
Jan 24th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. // PROTOTYPE CHAIN : software --> Object.prototype --> null
  2. var software = {
  3. language : "JavaScript"
  4. }
  5.  
  6. // Searches for property 'language' in software object and prints it.
  7. console.log(software.language);
  8.  
  9. // PROTOTYPE CHAIN : framework --> software --> Object.prototype --> null
  10. var framework = Object.create(software);
  11.  
  12. // Searches for property 'language' in framework object, as it is not found.
  13. // Then searches for the property in the prototype of the object i,e software and finds it.
  14. console.log(framework.language);
  15.  
  16. // PROTOTYPE CHAIN : website --> framework --> software --> Object.prototype --> null
  17. var website = Object.create(framework);
  18.  
  19. // Searches for property 'language' in website object, as it is not found.
  20. // Then searches for the property in the prototype of website i,e framework, as it is not found even here
  21. // Then searches for the property in the prototype of framework i,e software
  22. console.log(website.language);
Add Comment
Please, Sign In to add comment