JavaScript Is Weird
<i>0.2 + 0.1 === 0.3</i><p>That&#x27;s not really a JS problem, that&#x27;s a floating point problem. Plenty of languages will have the same issue.<p><i>+!![]</i><p><i>&quot;&quot; - - &quot;&quot;</i><p><i>(null - 0) + &quot;0&quot;</i><p>Calling these things weird is fair enough but I can&#x27;t help thinking this is code you&#x27;d never actually write outside of the context of a &quot;Look how weird JS is!&quot; post. It&#x27;s like picking examples from the Annual Obfuscated C Contest to show how hard it is to understand C. Yes, some languages enable you to write weird garbage code that&#x27;s hard to reason about, and ideally they wouldn&#x27;t because enforcing sane code would be great, but <i>come on</i>. Most of these things aren&#x27;t a big problem that we suffer every day. Just be <i>moderately</i> careful about casting things from one data type to another and <i>all</i> these problems go away.