美文网首页
Callback function - javascript

Callback function - javascript

作者: Zihowe | 来源:发表于2017-08-31 16:44 被阅读9次

    Callback is really simple once you understand javascript engine.

    "use strict";
    
    function f1 (count, callback) {
        // block the callback
        for (var i = 0; i < count; i++) {
            for (var j = 0; j < count; j++) {
                // do nothing
            }
        }
        
        callback();
    };
    
    
    f1(80000, function() {
        console.log("callback function");
    });
    

    相关文章

      网友评论

          本文标题:Callback function - javascript

          本文链接:https://www.haomeiwen.com/subject/yunqjxtx.html