js functions Flashcards
1
Q
What is a function in JavaScript?
A
Block of code that can be called
2
Q
Describe the parts of a function definition.
A
function myfunction(param1, param2) { //code} keyword function, name of function, arguments, curly braces, code
3
Q
Describe the parts of a function call.
A
myFunction(arg1, arg2); function name, parenthesis, arguments
4
Q
When comparing them side-by-side, what are the differences between a function call and a function definition?
A
function definition has function keyword and parameters function call has arguments
5
Q
What is the difference between a parameter and an argument?
A
parameter is a placeholder
arguments contain values that can be passed
6
Q
Why are function parameters useful?
A
the function can then operate according to different situations
7
Q
What two effects does a return statement have on the behavior of a function?
A
return will give the result of the function a value after the function is called
return will exit the function