javascript fn.init 原型链练习
;(function(window,document){ var Constant=function() { return Constant.fn.init(); }; Constant.fn=Constant.prototype={ url: 'http://url', dataUrl:'http://192.168.18.210/', sessionKey: '', param : '', clientType: 'PC', init: function(){ this.sessionKey=""; this.param={'clientType': 'PC','sessionKey':this.sessionKey}; return this; } }; Constant.fn.init.prototype=Constant.fn; window.constant=Constant; })(window,document);