In javascript, is an empty string always false as a boolean?

Yes. Javascript is a dialect of ECMAScript, and ECMAScript language specification clearly defines this behavior:

ToBoolean

The result is false if the argument is the empty String (its length is zero);
otherwise the result is true

Quote taken from http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf

Leave a Comment