function Person(name) {
this.name = name;
}
//在Person的原型对象上进行添加,避免影响到全局变量(造成变量污染).
Person.prototype.sayHi=function(){
console.log(this.name);
}
var p1 = new Person("我是周润发");
var p2 = new Person("我是周结论");
function sayHi(){
console.log("123");
}
p1.sayHi();