5 ms·
I guess JS inherited this language feature from the PHP/Perl world. As a novice, it is quite handy to treat numbers and strings of numbers the same. Needless to
by ktpsns 7y ago
I guess JS inherited this language feature from the PHP/Perl world. As a novice, it is quite handy to treat numbers and strings of numbers the same. Needless to say that it gets into your way once you are an experienced programmer.
Many languages like C or Python cast types to Boolean when instances are evaluated in Boolean contexts. That seems better defined. Then it should make sense that bool("0")==True.