码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2018-10-02 14:22:42      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:return   turn   name   prototype   构造   模式   var   函数   UNC   

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

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

标签:return   turn   name   prototype   构造   模式   var   函数   UNC   

原文地址:https://www.cnblogs.com/yuyedaocao/p/9736317.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!