por qué change() en el constructor no está definido, se debe acceder a través del enlace proto en la p. proto ? por qué change() en el constructor no está definido, se debe acceder a través del enlace proto en la p. proto ? por qué change() en el constructor no está definido, se debe acceder a través del enlace proto en la p. proto ? por qué change() en el constructor no está definido, se debe acceder a través del enlace proto en la p. proto ?
//the first change() is not defined ,why class Person { constructor() { console.log(this) console.log(this.__proto__) // change()//output:is not define } change() { console.log(this) } } var p = new Person() Object.prototype.change = function() { console.log(' change in prototype') } change() //output:change in prototypeIntente llamarlo con esta palabra clave.
//the first change() is not defined ,why class Person { constructor() { console.log(this) console.log(this.__proto__) this.change()//output:is not define } change() { console.log(this) } } var p =new Person() Object.prototype.change=function() { console.log(' change in prototype') } change()//output:change in prototype