V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
TeslaM3
V2EX  ›  程序员

记录一坨代码

  •  
  •   TeslaM3 · 77 天前 · 910 次点击
    这是一个创建于 77 天前的主题,其中的信息可能已经有所发展或是发生改变。
    function test() {
    	console.log("Hello world!");
    }
     
    (function(){
        var box = function() {
            return box.fn.init();
        };
    
        box.prototype = box.fn = {
            init : function(){
                console.log('box.init()');
    
    			return this;
            },
    
    		add : function(str) {
    			alert("add", str);
    
    			return this;
    		},
    
    		remove : function(str) {
    			alert("remove", str);
    
    			return this;
    		}
        };
        
        box.fn.init.prototype = box.fn;
        
        window.box =box;
    })();
    
    var testBox = box();
    testBox.add("jQuery").remove("jQuery");
    
    2 条回复
    Track13
        1
    Track13  
       77 天前
    要是拿这个面试我,那我可过不了。
    TeslaM3
        2
    TeslaM3  
    OP
       77 天前
    @Track13 你想笑死我,但是我没有证据
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1888 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 06:29 · PVG 14:29 · LAX 23:29 · JFK 02:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.