JS functions Flashcards
What is a function in JavaScript?
reusable set of instructions to be used in the future
Describe the parts of a function definition.
function keyword, function name(optional), parameters and code block, return value (optional)
Describe the parts of a function call.
function name and set of arguments inside parenthesis
When comparing them side-by-side, what are the differences between a function call and a function definition?
parameters vs arguments- function calls do NOT have a code block
What is the difference between a parameter and an argument?
parameters are placeholders for arguments
Why are function parameters useful?
pass information
What two effects does a return statement have on the behavior of a function?
stops the function entirely and gives the value of the return