2 ms·
Which is not really needed here. isDone will be boolean, and the other ones are still Truthy / Falsey values...
by coldtea 7y ago
Which is not really needed here. isDone will be boolean, and the other ones are still Truthy / Falsey values...
- allannienhuis 7y agoif the first term is undefined, isDone will be undefined, not false. At least in Javascript. && returns the falsy value on the left side of the expression if it evaluates to a falsy value (undefined && true) evaluates to undefined correspondingly || returns the truthy value (which might be an object) on the left hand side if evaluates truthy. That's useful for expressions like this: const a = b || 'default value'; !! turns truthy/falsy values into booleans.
- deleted 7y ago[deleted]
- coldtea 7y agoTrue, !! is still needed to get a True/False instead of the truthy/falsey value...