Nexodus Archive: Fediverse


<p>is there really no low-level mechanism to intercept boolean primitive coercion in JavaScript?</p><p>why can’t I extend `Boolean` to make `new MyBoolean(false)` be `falsy`? (I understand why it isn’t, but I want to make it so)</p><p>> Note: Unlike other type conversions like string coercion or number coercion, boolean coercion does not attempt to convert objects to primitives by calling user methods.</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean#boolean_coercion" target="_blank" rel="nofollow noopener" translate="no"><span class="invisible">https://</span><span class="ellipsis">developer.mozilla.org/en-US/do</span><span class="invisible">cs/Web/JavaScript/Reference/Global_Objects/Boolean#boolean_coercion</span></a></p>