I've noticed that if you have a statement as the following:
var test = "" || null
test
will evaluate to null
but if we do something like the following:
var test = "test" || null
test
will evaluate to "test", the same holds true for any object in place of the string, so does javascript treat empty string as either a falsy or null value, and if so why? Isn't an empty string still an object, so shouldn't it be handled the same?
I've tested this out in FireFox, Chrome, IE7/8/9, and Node.