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");
});
网友评论