js callback
-
10. CallbackJavaScript & TypeScript 2020. 11. 15. 14:28
JavaScript is synchronous Execute the code block in order after hoisting hoisting : var, function declaration console.log('1'); setTimeout(() => console.log('2'), 1000); console.log('3'); // 1, 3, 2 Synchronous callback function printImmediately(print) { print(); } printImmediately(() => console.log('hello')); Asynchronous callback function printWithDelay(print, timeout) { setTimeout(print, time..