Truthy/Falsy Flashcards
0
Q
Truthy/Falsy:
function testNumber(x) { if(!x) { console.log("no number entered"); } ...
When will this test fail?
A
When x==0 (falsy) the test will if statement will pass and log that no number was entered.
1
Q
Truthy/Falsy:
Which values are considered falsy in JavaScript?
A
False, NaN, undefined, -0, 0, “”, null