javascript-functions Flashcards
Describe the parts of a function definition.
function keyword, function name (optional), parameters surrounded by parentheses ( ), and function code block with opening and closing curly braces { }
Describe the parts of a function call.
function name and parentheses ( ) next to it; inside the parentheses is where the argument for the function parameters go
When comparing them side-by-side, what are the differences between a function call and a function definition?
function calls don’t need the function keyword or curly braces for the function block. Also, arguments are inputted in the parentheses ( ) for the function call instead of parameters
What is the difference between a parameter and an argument?
parameter is a placeholder for the argument
Why are function parameters useful?
it’s great for calling different arguments in the function
What two effects does a return statement have on the behavior of a function?
it causes the function to produce the value and prevents any more code from running
What is a function in JavaScript?
a function lets you group statements to perform a certain task