skip to Main Content
const obj = {
    name: "John",
    getName: function() {
        return  this.name
              
    }
}

console.log("Type", typeof(obj.getName())) 

const obj2 = {
    roll: 2,
    desig: "Software developer",
    name : "Peter",
    _proto_: obj 

}
console.log(obj2.getName())

2

Answers


  1. __proto__ with two underscores on each side, not one.

    Login or Signup to reply.
  2. It should be __proto__ not _proto_

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search