Junior
What values in JavaScript are considered falsy?
sobes.tech AI
Answer from AI
In JavaScript, "falsy" values include:
false- The boolean valuefalseitself.0- Numeric zero (both integer and floating point, e.g.,0.0).-0- Negative zero.""- Empty string.null- A special value indicating "no object".undefined- The default value of a variable if no other value is assigned, and the result of accessing a non-existent property of an object.NaN- Not-a-Number, the result of invalid mathematical operations.
These values are coerced to false when used in a boolean context, such as in an if statement. All other values (objects, arrays, non-empty strings, numbers other than zero, etc.) are considered "truthy".