JS PRIMITIVES & VARIABLES Flashcards

1
Q

What is the purpose of variables?

A

A script stores bits on info as data into variables

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 state a variable keyword, name the variable and provide it a value with an assignment operator

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 assignment operator

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

Variable names must be unique in a Dataset. Variable names are up to 64 characters long and can only contain letters, digits and nonpunctuation characters (except that a period (.) is allowed. also uses camelCase
_$ can not start with numbers

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

All variable names must be types with consistent capitaliztion of letters

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 stores value of letter and other characters, typically used to add 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

Identifies data for numbers for use in mathmatical operations

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

What is the purpose of boolean?

A

It is a data type that identifes true/false values, decision making

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 operator that equals a given value

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

As JS is cascading a new variable declaration can be made and given a new value

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
Null = no value given;
undefined = empty;
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

It labels what the specific console is doing

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

Give five examples of JavaScript primitives.

A

number, string, bollean, null, undefined

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