Conditional branching: if, '?' Flashcards

1
Q

all become false. Because of that they are called “falsy” values.

A

A number 0,
an empty string “”,
null,
undefined,
NaN

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

shorten below and why

let accessAllowed = age > 18 ? true : false;

A

let accessAllowed = age > 18

can avoid using the question mark operator because the comparison itself returns true/false:

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