Javascript Functions Flashcards
What is a function in JavaScript?
when called upon it executes a piece of code
Describe the parts of a function definition.
var functionName (parameter) {
code to be executed
return value
}
Describe the parts of a function call.
functionName(argument(s))
When comparing them side-by-side, what are the differences between a function call and a function definition?
function calls are missing keywords and definition is missing the arguments.
What is the difference between a parameter and an argument?
parameter describes what should be put in
argument is whats put in
Why are function parameters useful?
gives a description for later use
What two effects does a return statement have on the behavior of a function?
Sends back a value to the function and ends the function.