Skip to content

Commit 1886fa6

Browse files
authored
JavaScript execution model: Fix typos and improve clarity (mdn#41842)
Fix typos and improve clarity in execution model doc
1 parent 1f00512 commit 1886fa6

File tree

1 file changed

+2
-2
lines changed
  • files/en-us/web/javascript/reference/execution_model

1 file changed

+2
-2
lines changed

files/en-us/web/javascript/reference/execution_model/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The diagram below illustrates the execution model of agents:
4949

5050
## Realms
5151

52-
Each agent owns one or more **realms**. Each piece of JavaScript code is associated with a realm when it's loaded, which remains the same even when called from another realm. A realm consists of the follow information:
52+
Each agent owns one or more **realms**. Each piece of JavaScript code is associated with a realm when it's loaded, which remains the same even when called from another realm. A realm consists of the following information:
5353

5454
- A list of intrinsic objects like `Array`, `Array.prototype`, etc.
5555
- Globally declared variables, the value of [`globalThis`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis), and the global object
@@ -173,7 +173,7 @@ promise.then(() => {
173173

174174
In this example, we create an already-resolved promise, which means any callback attached to it will be immediately scheduled as jobs. The two callbacks seem to cause a race condition, but actually, the output is fully predictable: `1` and `2` will be logged in order. This is because each job runs to completion before the next one is executed, so the overall order is always `i += 1; console.log(i); i += 1; console.log(i);` and never `i += 1; i += 1; console.log(i); console.log(i);`.
175175

176-
A downside of this model is that if a job takes too long to complete, the web application is unable to process user interactions like click or scroll. The browser mitigates this with the "a script is taking too long to run" dialog. A good practice to follow is to make job processing short and if possible cut down one job into several jobs.
176+
A downside of this model is that if a job takes too long to complete, the web application is unable to process user interactions like click or scroll. The browser mitigates this with the "a script is taking too long to run" dialog. A good practice to follow is to make job processing short and, if possible, cut down one job into several jobs.
177177

178178
### Never blocking
179179

0 commit comments

Comments
 (0)