what is event loop in javascript
The Event Loop has one simple job — to monitor the Call Stack
and the Callback Queue
what is event loop in javascript
The Event Loop has one simple job — to monitor the Call Stack
and the Callback Queue
event loop javascript
console.log('Hi!');
setTimeout(() => {
console.log('Execute immediately.');
}, 0);
console.log('Bye!');
// print order
// 'Hi!'
// 'Bye!'
// 'Execute immediately.'
javascript event loop
function task(message) {
// emulate time consuming task
let n = 10000000000;
while (n > 0){
n--;
}
console.log(message);
}
console.log('Start script...');
task('Download a file.');
console.log('Done!');
Code language: JavaScript (javascript)
javascript event loop
function foo(b) {
let a = 10
return a + b + 11
}
function bar(x) {
let y = 3
return foo(x * y)
}
const baz = bar(7) // assigns 42 to baz
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us