JavaScript - Syntax : Variables Flashcards

1
Q

What is a variable in programming?

A

A container for a value.

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

What does a variable provide for data in programming?

A

A way of labeling data with a descriptive name.

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

What is the first action that can happen to a variable?

A

Declare/Define

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

What does it mean to declare/define a variable?

A

Request a location in memory of a given size with a descriptive name.

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

What is the second action that can happen to a variable?

A

Initialise

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

What does initialising a variable do?

A

Set the location in memory to a known value.

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

What is the third action that can happen to a variable?

A

Use

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

What does using a variable entail?

A

Store or update information stored in a variable.

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

What is the fourth action that can happen to a variable?

A

Destroy

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

What happens when a variable is destroyed?

A

Remove the label on the location in memory and release the memory back to the operating system.

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

What keyword is used to declare a variable that is available throughout the function?

A

var

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

Where are variables declared by the ‘let’ keyword available?

A

Only inside the block where they’re defined.

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

What does the ‘const’ keyword do?

A

Creates a variable that cannot be reassigned after it has been assigned a value.

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

Fill in the blank: To create a variable that cannot be reassigned, use the _______ keyword.

A

const

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