mantapweb.com
Event Loop di Javascript - MantapWeb
Pertama coba lihat code berikut terutama bagian output : main(); function main() { console.log('main Begin'); call(function () {console.log('Callback 1');}); //Call callback after 0 miliseconds. setTimeout(function () {console.log('Callback 2')}, 0); console.log('Long running process begin'); longRunningProcess(); console.log('Long running process end'); console.log('main End'); function call(cb) {cb();} function longRunningProcess(){for (var i = 0; i < 1000000000; i++);} } //Output: //main …