in javascript,
var a = '';
var b = (a) ? true : false;
var b
will be set to false
.
is this a defined behavior that can be relied upon?
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