Javascript Functions Flashcards

1
Q

What is a function in JavaScript?

A

when called upon it executes a piece of code

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

var functionName (parameter) {
code to be executed
return value
}

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

functionName(argument(s))

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 calls are missing keywords and definition is missing the arguments.

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 describes what should be put in
argument is whats put in

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

Why are function parameters useful?

A

gives a description for later use

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

Sends back a value to the function and ends the function.

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