© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
J. BartlettProgramming for Absolute Beginnershttps://doi.org/10.1007/978-1-4842-8751-4_13

13. Recursive Functions and the Stack

Jonathan Bartlett1  
(1)
Tulsa, OK, USA
 

In Chapter 10, you learned that functions can be used to package together pieces of code into well-defined units that can be reused over and over again. In this chapter, we are going to go into more detail about how JavaScript keeps track of these functions.

13.1 The Program Stack

Previously, we talked about local variables (variables defined within functions) and global variables (variables defined outside of functions). We mentioned that local variables are specific to the function that they ...

Get Programming for Absolute Beginners: Using the JavaScript Programming Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.