Truthy and falsy
When a non-boolean is used in a condition, JavaScript coerces it. The seven falsy values are listed above. Note the gotcha:
console.log([] ? "truthy" : "falsy"); // truthy
console.log({} ? "truthy" : "falsy"); // truthy
console.log(0 ? "truthy" : "falsy"); // falsy
Empty collections are truthy, so check .length or .size explicitly when testing for emptiness.