Javascript-Primitives-and-Variables Flashcards

1
Q

What is the purpose of variables?

A

Variables are used to store data

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

How do you declare a variable?

A

You use a variable keyword like var followed by creating a variable name

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

How do you initialize (assign a value to) a variable?

A

Use the assignment operator which is an = sign

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

What characters are allowed in variable names?

A

Numbers, Letters, dollar sign $, and underscore _

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

What does it mean to say that variable names are “case sensitive”?

A

If two variables with the same name start with different case types, then they will become different variables.

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

What is the purpose of a string?

A

Strings can be used as a data type related to text.

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

What is the purpose of a number?

A

Numbers can be used as a data type when a numerical value needs to be stored.
Used for calculating.

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

What is the purpose of a boolean?

A

A boolean data type can be used to determine if something is true or false.

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

What does the = operator mean in JavaScript?

A

It is the assignment operator that assigns a data value to a variable name

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

How do you update the value of a variable?

A

Use the assign operator to assign an updated value to the variable name.

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

What is the difference between null and undefined?

A

A null data type assigned to a variable is purposefully empty and undefined data type indicates that the variable does not have a value assigned to it.

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

Why is it a good habit to include “labels” when you log values to the browser console?

A

Including labels helps you understand the variable value being logged by supplying a brief description

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

Give five examples of JavaScript primitives.

A

String, Number, Boolean, Null, Undefined

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