javascript-primitives-and-variable Flashcards

1
Q

What is the purpose of a variable?

A

To give permanence to a value

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

How do you declare a variable?

A

use the variable keyword var

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

How do you initialize a variable?

A

use the var keyword if it hasn’t been declared then have a value on the other side of an equals.

var keyword = swag

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

letters, numbers, underscore, dollar sign

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

var javaScript is interpreted differently than var javascript

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

It’s a data type that allows you to store all types of characters that JS will not register as code.

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

For mathematical operations

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

It’s for decision making. It gives a way to create paths. on or off. if it is do this, if it isnt do this.

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

assignment.

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
var keyword = 6
keyword = 9
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

undefined is when a var has not been assigned a value (JS way of saying there is nothing here) and null is a placeholder (also empty, but on purpose).

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

organization shortcut

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

Name 5 examples of JavaScript primitives?

A

string, number, boolean, undefined, null

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