Summary: Functions
Review what we learned about functions in JavaScript.
We'll cover the following
Key points
- Functions can be defined using the
function
declaration, or by creating a function expression by assigning an anonymous function to a variable. - Arrow functions are a shorthand notation that can used for writing short, one-line, anonymous functions.
- All functions return a value. If this isn’t explicitly stated, the function will return
undefined
. - A parameter is a value that’s written in the parentheses of a function declaration and can be used like a variable inside the function’s body.
- An argument is a value that’s provided to a function when it’s called.
- The return value of a function can be assigned to a variable.
- A callback is a function that’s provided as an argument to another function and can be called from within the body of that function.
Functions are a really important part of any programming language. But so are “objects”—which we’ll be learning about after the quiz and challenge!
Get hands-on with 1400+ tech skills courses.