Truthy & Falsy Values
Which of the following expressions will evaluate to true?
Boolean('false') evaluates to true. Although the string contains the word 'false', it's a non-empty string, and all non-empty strings are truthy in JavaScript. The Boolean() function, or implicit boolean conversion, cares about the type and 'emptiness' of a value, not its semantic meaning. So while the string 'false' might semantically represent falsehood, from JavaScript's type conversion perspective, it's a non-empty string and therefore truthy. This highlights the importance of distinguishing between the semantic meaning of data and how JavaScript evaluates it in a boolean context.