1.2 Flashcards

1
Q

What are the six primitive data types?

A
Strings
Numbers
Booleans
Null 
Undefined 
Symbol
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

String

A

Text that is generally wrapped in single or double quotes

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

\

What is the backslash used for in a string?

A

If you wanted to include a double/single quote within a string.
It’s used to escape and tell Javascript that the quotes should be displayed as quotes

var escapeText = “He said: \”Yes!”\, that’s for sure.”;

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

What does concatenation mean?

A

To combine strings

Use the + sign to join strings

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

Integer

A

A number with no decimal points.

Everyday round numbers: 1, 5, 17, 5,394 etc

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

A float

A

Anything that does have a decimal point with at least one number following the point

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

Boolean

A

True or False

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

Null

A

Indicated that the value has been set to be empty purposefully

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

Undefined

A

Indicates that the value was never set

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

Objects

A

Contains a set of key-value pairs.
Like an unordered list of data

var car = {
color: ‘red’,
mileage: 10
};

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

Array

A

Ordered lists of data items.
Items inside done have keys.
Simply a list of data values

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

Arrays are indicated by comma-separated values between square brackets. Just like with normal objects, you can either place all the values on the same line or give each of the values their own line:

A
var numberArray = [1, 2, 3];
// or
var numberArray2 = [
  1,
  2,
  3
];
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

// array of strings

A

var foodArray = [‘pizza’, ‘tuna’, ‘apple’];

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

// array of objects

A
var carArray = [
  { type: 'Bus', wheels: 4, color: 'blue'},
  { type: 'Sport', wheels: 4, color: 'red'}
];
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

// array of arrays

A
var myCalculatorNumbers = [
  [1, 2, 3],
  [3, 4, 6],
  [7, 8, 9]
];
How well did you know this?
1
Not at all
2
3
4
5
Perfectly