values, types, and operators Flashcards

1
Q

Values of the number type are, unsurprisingly, _______ values.

A

numeric

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

There are three special values in JavaScript that are considered numbers but don’t behave like normal numbers. They are _____, ______, and ______?

A

Infinity, -Infinity, NaN

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

______s are used to represent text. They are written by enclosing their content in quotes.

A

string

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

+, - , * , / , typeof are called _______

A

operators

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

The minus sign - can be both a unary and binary operator. True/False

A

True

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

Which operators are arithmetic ?

A

+, -, *, /, and %

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

Which operators are or can be unary?

A

typeof and -

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

The Boolean type has what to possible values?

A

True or False

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

This one is called the conditional operator (or sometimes just the ______ operator since it is the only such operator in the language). true ? 1 : 2

A

Ternary

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

____ and _____, that are used to denote the absence of a meaningful value. They are themselves values, but they carry no information.

A

null and undefined

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

When something that doesn’t map to a number in an obvious way (such as “five” or undefined) is converted to a number, you get the value ______,

A

NaN

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

When an operator is applied to the “wrong” type of value, JavaScript will quietly convert that value to the type it needs, using a set of rules that often aren’t what you want or expect. This is called __________.

A

type coercion

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

console.log(8 * null)

A

0

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

console.log(“5” - 1)

A

4

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

console.log(“5” + 1)

A

51

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

console.log(“five” * 2)

A

NaN

17
Q

console.log(false == 0)

A

true

18
Q

console.log(null == undefined);

A

true

19
Q

console.log(null == 0);

A

false

20
Q

When you want to test whether a value has a real value instead of _____ or _______, you can compare it to null with the == (or !=) operator.

A

null or undefined

21
Q

console.log(null || “user”)

A

user

22
Q

console.log(“Agnes” || “user”)

A

Agnes

23
Q

the second argument is executed or evaluated only if the first argument does not suffice to determine the value of the expression

A

short-circuit evaluation

24
Q

Which operator is used for string concatenation

A

+

25
Q

Which operators are used for comparison?

A

”==”, “!=”, “===”, “!==”, “”, “<=”, “>=”

26
Q

Which are the logic operators?

A

&&, ||

27
Q

is used to negate logically

A

!

28
Q

is used to negate a number

A

-