DEV Community

Cover image for Call Stack in Javascript
 Rahul Gupta
Rahul Gupta

Posted on

Call Stack in Javascript

Call Stack is a data structure for javascript interpreters to keep track of function calls in the program. It has two major actions:

Whenever you call a function for its execution, you are pushing it to the stack.
Whenever the execution is completed, the function is popped out of the stack.

`function hungry() {
eatFruits();
}
function eatFruits() {
return "I'm eating fruits";
}

// Invoke the hungry function
hungry(); `

Top comments (0)