Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // PROTOTYPE CHAIN : software --> Object.prototype --> null
- var software = {
- language : "JavaScript"
- }
- // Searches for property 'language' in software object and prints it.
- console.log(software.language);
- // PROTOTYPE CHAIN : framework --> software --> Object.prototype --> null
- var framework = Object.create(software);
- // Searches for property 'language' in framework object, as it is not found.
- // Then searches for the property in the prototype of the object i,e software and finds it.
- console.log(framework.language);
- // PROTOTYPE CHAIN : website --> framework --> software --> Object.prototype --> null
- var website = Object.create(framework);
- // Searches for property 'language' in website object, as it is not found.
- // Then searches for the property in the prototype of website i,e framework, as it is not found even here
- // Then searches for the property in the prototype of framework i,e software
- console.log(website.language);
Add Comment
Please, Sign In to add comment