Callback function - javascript

2017-08-31  本文已影响9人  Zihowe

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");
});
上一篇下一篇

猜你喜欢

热点阅读