JS FUNCTIONS Flashcards
What is a function in JavaScript?
Group of commands that performs a certain task
Describe the parts of a function definition.
function keyword (parameter) {code to be executed return}
Describe the parts of a function call.
Functions need to be called for it be executed. function(0 or more arguements);
When comparing them side-by-side, what are the differences between a function call and a function definition?
function definition contain the function key and the specific property of the parameter being called as well as contain the code to be executed
the function call has the name of the function with the arguement being used
What is the difference between a parameter and an argument?
The values that are declared within a function when the function is called are known as an argument. Whereas, the variables that are defined when the function is declared are known as a parameter.
What is the difference between a parameter and an argument?
The values that are declared within a function when the function is called are known as an argument. Whereas, the variables that are defined when the function is declared are known as a parameter.
Why are function parameters useful?
It specifies what kind of variables will be used for the function. Otherwise it would be difficult to specify which arguements to be used in a function
What two effects does a return statement have on the behavior of a function?
A return statement ends the execution of a function, and returns control to the calling function.