码迷,mamicode.com
首页 > 编程语言 > 详细

javascript设计模式(1)——面向对象基础

时间:2017-12-14 21:22:39      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:script   this   post   log   return   pos   基础   obj   设计模式   

用对象收编变量2种方式

1 函数式

var Object = {

   name:function(){ return this; },

   email:function(){ return this; }

}

Object.name().email();

2 类式

var Object = function(){};

Object.prototype = {

   name:function(){ return this; },

   email:function(){ return this; }

}

 

javascript设计模式(1)——面向对象基础

标签:script   this   post   log   return   pos   基础   obj   设计模式   

原文地址:http://www.cnblogs.com/rudylemon/p/8039216.html

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