javascript設計模式(1)——面向對象基礎

用對象收編變量2種方式函數

1 函數式this

var Object = {prototype

   name:function(){ return this; },對象

   email:function(){ return this; }io

}function

Object.name().email();email

2 類式變量

var Object = function(){};mail

Object.prototype = {return

   name:function(){ return this; },

   email:function(){ return this; }

}

相關文章
相關標籤/搜索