构造函数+原型的js混合模式

function Parent(){
  this.name = "李小龙";
  this.age = "30"; 
};
Parent.prototype.lev=function(){
  return this.name;
}
var x=Parent();
alert(x.name);
alert(x.lev());

posted @ 2018-10-02 08:57  雨夜稻草  阅读(217)  评论(0编辑  收藏  举报