Javascript-functions Flashcards

1
Q

What is a function in Javascript?

A

code block perform action

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe the parts of a function definition

A
  1. function
  2. function name example: hello
  3. parameter ()
  4. the start of the function code block { opening curly brace
    5/ optional return statement
  5. the end of the function block } closing curly brace
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the parts of a function call

A
  1. function name
  2. () arguments
    sayHello();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why are function parameters useful?

A

alter behaviors that is pass in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What two effects does a return statement have on the behavior of a function?

A
  1. produce a value

2. prevents any more code in the function’s code block from being run

How well did you know this?
1
Not at all
2
3
4
5
Perfectly