javascript-functions Flashcards
What is a function in JavaScript?
a set of statements that perform a task
Describe the parts of a function definition.
function key word, optional name, list of parameters and decleration block
Describe the parts of a function call.
name of function arguments and semicolon
When comparing them side-by-side, what are the differences between a function call and a function definition?
a call runs the code in a a declaration block and definition is the code that makes up a declaration block
What is the difference between a parameter and an argument?
parameters are a placeholder arguments are the actual values
Why are function parameters useful?
they can be used with being given a value
What two effects does a return statement have on the behavior of a function?
Causes the function to produce a value we can use in our program.
Prevents any more code in the function’s code block from being run.