Glossary
Call stack

Call stack

In programming, a call stack is an ordered list of the functions (or stack frames) a program has to execute before it returns a result. It has a Last In, First Out (LIFO) structure where new functions added are pushed to the top of the stack. When the top function finishes, that stack frame disappears or pops, and the program moves to the next. Think of it as a program’s to-do list, going through functions one by one to complete a task.

Many JavaScript programs use call stacks to streamline functions. One example of call stacks at work is data validation. If you’re designing an account registration page, you need a way to check if a user is already registered. First, the program queries a user database — that task moves to the top of the call stack. After it makes the query, that task disappears and the program moves on to the next one: either reminding users they have an account or continuing the registration process.

Stack overflow is a common error when your stack adds more functions without removing them. This might happen if the program ends up in a loop: B can’t complete without A, and A can’t complete without B.

If you’re adding custom code to your Webflow site by embedding it, adding it to head or body tags, or using it in the CMS, you might need to access and edit the call stack for debugging. You can find the call stack in Chrome by opening DevTools Sources and expanding the Call Stack panel on the right. In Safari, go to Develop>Show Web Inspector, and the call stack box should appear on the left.

Other glossary terms