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);
![](https://images2015.cnblogs.com/blog/481577/201611/481577-20161124113055253-338809388.png)