prototype属性

function People(name){

	this.name=name;
	//对象方法
	this.Introduce=function(){
		console.log(this.name);
	}
}
//类方法
People.Run=function(){
	console.log("I can run");
}
//原型方法
People.prototype.IntroduceChinese=function(){
	console.log(this.name);
}
 
//测试
var p1 = new People('132');
p1.Introduce();//132
People.Run();//I can run
p1.IntroduceChinese();//132

  

゛Toly★小饼干ゞ
原文地址:https://www.cnblogs.com/rockyan/p/7943583.html