20 Flashcards

(8 cards)

1
Q

Type conversion

A

manually convert types (explicitly)
Example: Number(‘1991’)

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

Type coercion

A

JS automatically converts types (implicitly)
Example: ‘1991’ + 18 = ‘199118’

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

Number(‘Jonas’)

A

NaN
(typeof NaN = number)

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

type conversions that make sense

A

String → Number
Number → String

Number → Boolean
Boolean → Number

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

Addition (+) converts to …

A

String
Example: ‘23’ + ‘10’ + 3 = ‘23103’

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

Subtraction (-) converts to …

A

Number
Example: ‘23’ - ‘10’ - 3 = 10

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

Multiplication (*) converts to …

A

Number
Example: ‘2’ * ‘3’ = 6

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

Division (/) converts to …

A

Number
Example: ‘6’ / 2 = 3

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