JavaScript-functions Flashcards
What is a function in JavaScript?
a set of statements that performs a task or calculates a value
Describe the parts of a function definition.
a set of outputs, and a rule that relates the elements of the set of inputs to the elements
Describe the parts of a function call.
function name, argument list, and a semicolon
When comparing them side-by-side, what are the differences between a function call and a function definition?
function call runs the code and function definition defines the function
What is the difference between a parameter and an argument?
Parameter is variable in the declaration of function.
Argument is the actual value of this variable that gets passed to function.
Why are function parameters useful?
Parameters are the names of the information that we want to use in a function or procedure
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.