Discovering Functions
Explore the concept of JavaScript functions to structure code into reusable, focused blocks that simplify complex problems. This lesson helps you understand function declaration, calling functions, and the benefits of modular coding for easier maintenance and reusability.
We'll cover the following...
We'll cover the following...
The role of functions
To understand the importance of functions, let’s refer back to the burrito algorithm.
Here’s the same general idea, written in a different way.
The first version details all the individual actions that make up the cooking process. The second breaks down the recipe into broader steps and introduces concepts that could be re-used for other dishes as well like cook, stir-fry, add and roll.
Our programs so far have mimicked the first example, but it’s time to start ...