javascript-functions Flashcards

1
Q

What is a function in JavaScript?

A

collections of instructions that can be repeated an infinite number of times

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
function name
parameters
code block
return statement
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

the function name and the arguments being passed into it inside the parentheses

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 has the parameter and the code block that it takes. the call takes the arguments that are passed into the function and code

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 are placeholders in function definition and arguments are the ones that are passed into the function

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

Why are function parameters useful?

A

allows you to pass information into the function

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

returns the value of code and stops executing the code block

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