Javascript-functions Flashcards
1
Q
What is a function in Javascript?
A
code block perform action
2
Q
Describe the parts of a function definition
A
- function
- function name example: hello
- parameter ()
- the start of the function code block { opening curly brace
5/ optional return statement - the end of the function block } closing curly brace
3
Q
Describe the parts of a function call
A
- function name
- () arguments
sayHello();
4
Q
When comparing them side-by-side, what are the differences between a function call and a function definition?
A
function definition tells what the code is expected to do. calling it excute the action of the function
5
Q
What is the difference between a parameter and an argument?
A
parameter= holds the value in function definition ( a placeholder) argument = passed though function call
6
Q
Why are function parameters useful?
A
alter behaviors that is pass in
7
Q
What two effects does a return statement have on the behavior of a function?
A
- produce a value
2. prevents any more code in the function’s code block from being run