JS FUNCTIONS Flashcards

1
Q

What is a function in JavaScript?

A

Group of commands that performs a certain task

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

function keyword (parameter) {code to be executed return}

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
Functions need to be called for it be executed.
function(0 or more arguements);
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 contain the function key and the specific property of the parameter being called as well as contain the code to be executed

the function call has the name of the function with the arguement being used

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

The values that are declared within a function when the function is called are known as an argument. Whereas, the variables that are defined when the function is declared are known as a parameter.

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

What is the difference between a parameter and an argument?

A

The values that are declared within a function when the function is called are known as an argument. Whereas, the variables that are defined when the function is declared are known as a parameter.

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

Why are function parameters useful?

A

It specifies what kind of variables will be used for the function. Otherwise it would be difficult to specify which arguements to be used in a function

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

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

A

A return statement ends the execution of a function, and returns control to the calling function.

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