You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: improve technical accuracy in call stack concept page
- Update MDN links for execution contexts to point to correct documentation
- Clarify distinction between execution context and stack frame terminology
- Standardize terminology from 'Callback Queue' to 'Task Queue'
- Add note about Firefox's non-standard InternalError for stack overflow
Copy file name to clipboardExpand all lines: docs/concepts/call-stack.mdx
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,7 +100,7 @@ JavaScript is **[single-threaded](https://developer.mozilla.org/en-US/docs/Gloss
100
100
3.**Keep track of local variables** — Each function has its own variables that shouldn't interfere with others
101
101
102
102
<Info>
103
-
**ECMAScript Specification**: According to the official JavaScript specification, the call stack is implemented through "[execution contexts](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#description)." Each function call creates a new execution context that gets pushed onto the stack.
103
+
**ECMAScript Specification**: According to the official JavaScript specification, the call stack is implemented through "[execution contexts](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Execution_model#stack_and_execution_contexts)." Each function call creates a new execution context that gets pushed onto the stack.
104
104
</Info>
105
105
106
106
---
@@ -219,7 +219,7 @@ console.log("Done!");
219
219
220
220
## Execution Context: What's Actually on the Stack?
221
221
222
-
When we say a function is "on the stack," what does that actually mean? Each entry on the call stack is called an **[execution context](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#description)** (or **stack frame**). It contains everything JavaScript needs to execute that function.
222
+
When we say a function is "on the stack," what does that actually mean? Each entry on the call stack is called an **[execution context](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Execution_model#stack_and_execution_contexts)**, sometimes referred to as a **stack frame** in general computer science terms. It contains everything JavaScript needs to execute that function.
223
223
224
224
<AccordionGroup>
225
225
<Accordiontitle="Function Arguments">
@@ -476,9 +476,13 @@ Stack: [ empty ]
476
476
| Browser | Error Message |
477
477
|---------|---------------|
478
478
| Chrome |`RangeError: Maximum call stack size exceeded`|
479
-
| Firefox |`InternalError: too much recursion`|
479
+
| Firefox |`InternalError: too much recursion`(non-standard) |
480
480
| Safari |`RangeError: Maximum call stack size exceeded`|
481
481
482
+
<Note>
483
+
Firefox uses `InternalError` which is a non-standard error type specific to the SpiderMonkey engine. Chrome and Safari use the standard `RangeError`.
484
+
</Note>
485
+
482
486
### Common Causes of Stack Overflow
483
487
484
488
<AccordionGroup>
@@ -619,7 +623,7 @@ You might be wondering: "If JavaScript can only do one thing at a time, how does
619
623
Great question! The call stack is only **part** of the picture.
620
624
621
625
<Note>
622
-
When you use asynchronous functions like [`setTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout), [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API), or event listeners, JavaScript doesn't put them on the call stack immediately. Instead, they go through a different system involving the **[Event Loop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop)** and **Callback Queue**.
626
+
When you use asynchronous functions like [`setTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout), [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API), or event listeners, JavaScript doesn't put them on the call stack immediately. Instead, they go through a different system involving the **[Event Loop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop)** and **Task Queue**.
623
627
624
628
This is covered in detail in the [Event Loop](/concepts/event-loop) section.
0 commit comments