4 ms·
Nobody programs like that, so it's not an issue in real-world applications.
by davidkunz 5y ago
Nobody programs like that, so it's not an issue in real-world applications.
- qayxc 5y agoI would agree if wasn't for the fact that JS is a dynamically typed language. You can (and sometimes will) run into instances of this without noticing, because while you won't explicitly write true++ you might do something like x = someFunction() x++ not realising that someFunction() might return a boolean under some circumstances. Anyone who worked with a sufficiently large JS codebase ran into one of these cases and got unexpected results at some point due to this.
- wruza 5y agotrue++ and x++ are syntactically different though. The latter is a post-increment of an identifier, and the former is a post-increment of a boolean literal. Different rules may apply to these cases.
- davidkunz 5y agoThis is true, one must always make sure to handle all possible return types, but that's true for all dynamic languages.
- noisem4ker 5y agoNobody uses straight edge razors for juggling, so they're not dangerous when shaving.