javascript-primitives-and-variables Flashcards

1
Q

What is the purpose of variables?

A

Variables are used to store information.

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 declare a variable by using the reserved keyword var to declare a variable in JavaScript.

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

The way of initializing a variable is very similar to the use of PARAMETER attribute. More precisely, do the following to initial a variable with the value of an expression: add an equal sign (=) to the right of a variable name. to the right of the equal sign, write an expression.

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

The period, the underscore, and the characters $, #, and @ can be used within variable names.

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
"Case sensitive" variables mean that variables with capital and lowercase letters are different 
EX:
var variable = x
var Variable = y
var Variable = y
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 are a primitive data type in JavaScript. A string is textual content.

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

Number is a primitive wrapper object used to represent and manipulate numbers

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

Boolean refers to a system of logical thought that is used to create true/false statements.

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

The “=” operator means assignments in Javascript.

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

You can update the value of the variable by referencing the variable inside the function.

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:
It is the intentional absence of the value. It is one of the primitive values of JavaScript.
Undefined:
It means the value does not exist in the compiler.

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’s a good habit to include labels when you log values to the browser console because it helps you know what you’re looking at.

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

Give five examples of JavaScript primitives.

A

Five examples of Javascript primitives:

  1. Number
  2. String
  3. Boolean
  4. Undefined
  5. Null
How well did you know this?
1
Not at all
2
3
4
5
Perfectly