1.
function People (name){
this.name = name;
}
People.prototype.walk = function(){
console.log(this.name + ' is walking');
}
var p1 = new People('饥人谷');
var p2 = new People('前端');
原型图.jpg
2.
function People(){
}
var p = new People()
p.toString()
原型图2.jpg
网友评论