Skip to Content
Learning JavaScript Data Structures and Algorithms - Third Edition
book

Learning JavaScript Data Structures and Algorithms - Third Edition

by Loiane Avancini
April 2018
Beginner to intermediate content levelBeginner to intermediate
426 pages
10h 19m
English
Packt Publishing
Content preview from Learning JavaScript Data Structures and Algorithms - Third Edition

The call stack

We learned about the stack data structure in Chapter 4, Stacks. We will see it in action in a real application using recursion. Whenever a function is called by an algorithm, the function goes on the top of the call stack. When using recursion, each function call will be stacked on top of each other, due to the possibility of one call depending on the result of the previous invocation itself.

We can see the Call Stack in action using the browser, as demonstrated in the following screenshot:

If we execute factorial(3), open the developer tools of the browser, go to Sources, and add a breaking point in the Factorial.js file, when ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning JavaScript Data Structures and Algorithms

Learning JavaScript Data Structures and Algorithms

Loiane Avancini

Publisher Resources

ISBN: 9781788623872Supplemental Content