Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
An empty array is an object and is truthy. An empty string is falsy; Boolean conversion does not inspect an array's length.
Common falsy values include false, 0, -0, 0n, "", null, undefined, and NaN. Ordinary objects and arrays are truthy, even when empty. The strings "0" and "false" are also truthy because they are non-empty. To test whether an array contains items, check its length rather than its Boolean conversion.