real trace · browser-js
02. JavaScript runtime / Lesson 1 of 6 · beginner · 9 min · 12 steps

The call stack

Why one customer's support thread is a blank page.

1-min Short
support · threadCALL STACKempty

I open my support thread, and the page goes blank. Only yours? The console shows one line: RangeError, maximum call stack size exceeded.

IN THIS LESSONStep 1 of 12 · Ana's blank page0:00 / 2:27

Transcript

follows the lesson · 0 of 12 steps

The call stack: the whole lesson in words

One customer's support thread is a blank page. Every other thread loads.

The one-page cheatsheet for this lesson →

Sources

thread.js · agent-writtenjavascript
const comments = [
{ id: 'c1', parentId: null, text: 'Ana: where is my order?' },
{ id: 'c2', parentId: 'c1', text: 'Support: which order?' },
{ id: 'c3', parentId: 'c2', text: 'Ana: order 1042' },
{ id: 'c4', parentId: 'c1', text: 'Support: it ships today' },
];
function renderReplies(comment) {
console.log(comment.text);
for (const reply of comments) {
if (reply.parentId === comment.id) renderReplies(reply);
}
}
renderReplies(comments[0]);
CHEATSHEET

Opens after you lock in your predictions. It states the answers.