By the end of this lesson, you'll be able to:
- Define the concept of functions in JavaScript
- Create function declarations and expressions with appropriate syntax and naming conventions
- Declare and invoke functions with parameters and arguments
- Use the return statement and store returned values
- Understand what variables and functions a program has access to based on where it was declared
One of the best ways to create buggy code is to copy-paste a few lines of code across many files, then trying to update those lines consistently later. Luckily we have functions, or blocks of code you can run on command to perform a specific routine. Just call the function’s name and it comes running. In this lesson, we’ll learn how to wrap our reusable code into functions.
| Lesson | Skills & Learning Objectives |
|---|---|
| Concepts and Fundamentals | Explain how JavaScript functions can simplify complex tasks and promote code reusability. |
| Parameters and Arguments | Declare a function with parameters and call a function using arguments. |
| Return Values | Return data from functions using the return statement. |
| Scope | Clearly define lexical scope in JavaScript, illustrating its significance in structuring and accessing variables within code. |
| Functions and Arrays | Combine to powerful tools in JavaScript. |
