JavaScript-functions Flashcards

1
Q

What is a function in JavaScript?

A

a set of statements that performs a task or calculates a value

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

a set of outputs, and a rule that relates the elements of the set of inputs to the elements

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

function name, argument list, and a semicolon

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 call runs the code and function definition defines 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 is variable in the declaration of function.

Argument is the actual value of this variable that gets passed to function.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why are function parameters useful?

A

Parameters are the names of the information that we want to use in a function or procedure

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

Causes the function to produce a value we can use in our program.
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