Object Prototyping in javascript
Object prototyping
Following is sample javascript code.
const sample = {
name: 'alice',
place :'LA'
}
// here we are creating an object which will prototype to the sample object.
const prot = Object.create(sample)
console.log(prot.name) //which will console 'alice'
here when we check for properties in an object, if its not found there it will go to the prototype of that object, this is called prototype chaining, and inheriting a property from the prototype is called prototype inheritance.
Question: When will prototype ends?