Javascript Functions Flashcards

(10 cards)

1
Q

What is a JavaScript function?

A

A block of code designed to perform a specific task.

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

Why do we use functions?

A

To keep code clean, organized and reusable.

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

Which keyword is used to define a function?

A

function

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

When does a function run?

A

When it is called.

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

What is a parameter?

A

A variable that receives values inside a function.

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

What happens if a function does not have parameters?

A

It still works normally.

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

Why do we use “return” in a function?

A

To send a value back for later use.

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

What example is used to demonstrate how functions work?

A

A function that calculates an area of a rectangle.

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

Arguments are the values we send when we execute a function. (true or false)

A

True

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

Functions always show results on the screen & cannot store? (true or false)

A

False

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