Functions Recap
In this chapter, we learned how to work with functions in JavaScript. We found out that:
- We use functions when we want to group repeating code or solve a specific problem.
- We define a function using the
function
keyword followed by the function name, parentheses, and a colon. - The function body contains the code that is executed when the function is called. This code is indented.
- We call functions by using their name followed by parentheses.
- We can call a function only after its definition.
- Functions can accept parameters that affect their behavior.
- Parameters are specified in parentheses when defining the function, and we assign them values when calling the function.
- Function parameters can have default values that are used if the parameter value is not specified when the function is called.
- Functions can return values using the
return
keyword. Returning a value ends the execution of the function.
Instructions
Congratulations on completing the JavaScript course! Now, just practice and combine the learned concepts, and you'll be surprised at what you can program!
Start programming for free
7/7