
function Person(){
}
Person.prototype.name = "runzhi"
Person.prototype.getName = function(){
console.log(this.name)
}
var person1 = new Person()
person1.getName()
console.log(person1.hasOwnProperty('name'))
console.log("name" in person1)
person1.name = "hhhh"
person1.getName()
console.log(person1.hasOwnProperty('name'))
console.log(Person.prototype)
console.log(Person.prototype.constructor)
console.log(person1.__proto__)
function Pers(){
}
Pers.prototype = {
name: "tttt",
getName: function(){
console.log(this.name)
}
}
var pers = new Pers()
console.log(Pers.prototype.constructor)
console.log(pers.__proto__)
console.log(pers.constructor)
function Father(name){
this.name = name
}
var son = new Father("hjiji")
function Star(){
this.sing = function(){
console.log("ll")
}
}
var s1 = new Star()
var s2 = new Star()
console.log(s1.sing === s2.sing)
function Sta(){}
Sta.prototype.sing = function(){
console.log("ll")
}
var st1 = new Sta()
var st2 = new Sta()
console.log(st1.sing === st2.sing)