'' == false // true
' ' == false // true
if ('') {
// this code is not run
}
if (' ') {
// this code is run
}
As you can see, there are interesting results.
The empty string is treated as falsy
, as we already know.
However, whitespace strings are treated as truthy
or falsy
, depending on the situation.