2 ms·
> type coercion seems to be a pain point Yeah: Boolean("0"); // true I believe type coercian should pass through the types from simplest to most complex.
by combatentropy 8y ago
> type coercion seems to be a pain point
Yeah:
Boolean("0"); // true
I believe type coercian should pass through the types from simplest to most complex.
false; // boolean, the simplest data type
Number(false); // 0, number
String(Number(false)); // "0", string, so Boolean("0") should have been false