javascript-functions Flashcards

1
Q

Describe the parts of a function definition.

A

function keyword, function name (optional), parameters surrounded by parentheses ( ), and function code block with opening and closing curly braces { }

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

Describe the parts of a function call.

A

function name and parentheses ( ) next to it; inside the parentheses is where the argument for the function parameters go

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

When comparing them side-by-side, what are the differences between a function call and a function definition?

A

function calls don’t need the function keyword or curly braces for the function block. Also, arguments are inputted in the parentheses ( ) for the function call instead of parameters

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

What is the difference between a parameter and an argument?

A

parameter is a placeholder for the argument

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

Why are function parameters useful?

A

it’s great for calling different arguments in the function

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

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

A

it causes the function to produce the value and prevents any more code from running

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

What is a function in JavaScript?

A

a function lets you group statements to perform a certain task

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