| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Execution_model | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
JavaScript , , , C Java .
. JavaScript .
'' .
function foo(b) {
const a = 10;
return a + b + 11;
}
function bar(x) {
const y = 3;
return foo(x * y);
}
const baz = bar(7); // 42 baz
.
bar , bar .bar foo , foo .foo , (bar ).bar , .. ( ) .
JavaScript , . .
. , .
, .
while (queue.waitForMessage()) {
queue.processNextMessage();
}
queue.waitForMessage() .
.
. , , . , C , .
, . " " . , .
, . , . , . .
setTimeout . , ( , 0). () . setTimeout . , setTimeout . , '' .
setTimeout .
const seconds = new Date().getTime() / 1000;
setTimeout(function () {
// "2" , 500
console.log(`${new Date().getTime() / 1000 - seconds} .`);
}, 500);
while (true) {
if (new Date().getTime() / 1000 - seconds >= 2) {
console.log(", 2 .");
break;
}
}
0 0 . setTimeout 0 .
. ' ' . '' , .
setTimeout , .
(function () {
console.log("");
setTimeout(function cb() {
console.log(" 1: ");
}); // has a default time value of 0
console.log(" ");
setTimeout(function cb1() {
console.log(" 2: ");
}, 0);
console.log("");
})();
(() => {
console.log("");
setTimeout(() => {
console.log(" 1: ");
}); // 0 .
console.log("this is just a message");
setTimeout(() => {
console.log(" 2: ");
}, 0);
console.log("this is the end");
})();
// ""
// " "
// ""
// " 1: "
// " 2: "
iframe , , . postMessage . message , postMessage .
JavaScript . , , IndexedDB XHR , .
This page was last modified on 2025 5 7 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |