js匿名函数封装
(function(root,factory){ typeof exports === ‘object‘ && typeof module !== ‘undefined‘ ? module.exports = factory() : typeof define === ‘function‘ && define.amd ? define(factory) : (root.Demo = factory()); })(this,function(){ function Demo(option){ this._init(option) } Demo.prototype = { constructors: Demo, _init:function(option){ this.name = option.name; this.age = option.age; } } return Demo; });
原文地址:https://www.cnblogs.com/chachanode/p/10074716.html
时间: 2024-10-09 16:10:15