Andrea Koutifaris
1 min readJun 26, 2018

--

From your article:

...
// truthy values in JavaScript
"String" --> Any string
...

Which is wrong for an empty string.

const anObject = '';
if (anObject) {
console.log('I was true');
} else {
console.log('I was false');
}
// Will print 'I was false' for empty strings, 'I was true' for non empty strings or objects

The first point is prone to bugs, and thus a bad practice.

--

--

Andrea Koutifaris
Andrea Koutifaris

Responses (1)