<html> <head> </head> <body> </body> <script> (function () { var yQuery = (function () { var yQuery = function () { return yQuery.fn.init(); }; yQuery.fn = yQuery.prototype = { init: function () { return this; } }; yQuery.extend = yQuery.fn.extend = function () { var options, name, src, copy, target = arguments[0] || {}, i = 1, length = arguments.length; if (length === i) { target = this; --i; } for (; i < length; i++) { if ((options = arguments[i]) != null) { for (name in options) { src = target[name]; copy = options[name]; if (src === copy) { continue; } if (copy!==undefined) { target[name] = copy; } } } } return target; }; return yQuery; })(); window.yQuery = window.$ = yQuery(); })(); $.ui = $.ui || {}; $.extend($.ui,{name:'CSJ',getName:function(){return this.name}}); $.email = $.email || {}; $.extend($.email,{name:'[email protected]', getName:function(){return this.name}}); console.log($.ui.getName()); console.log($.email.getName()); </script> </html>
js 匿名函数
猜你喜欢
转载自yaohongxing.iteye.com/blog/2291302
今日推荐
周排行