Truthy and Falsy Values
Falsy values are false, 0, "", null, undefined, NaN and 0n. Everything else is truthy, including "0", [] and {}. Conditions use this conversion.
Example
const values = [0, "", null, undefined, NaN, "0", [], {}];
console.log(values.map((v) => Boolean(v)));Exercise
Convert to boolean.
(value)Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.