Fwd: Boolean equivalent to pre-increment and post-icnrement

Bob Myers rtm at gol.com
Wed Aug 29 19:13:37 UTC 2018


In the stupid idea of the day department, for some reason I have felt the
urge more than once in recent months for an operator which would invert the
value of a boolean variable while evaluating to its pre-inversion value.
For example:

```js
if (bool!!) console.log("used to be true");
```

The post-inversion case is less important since I can just write `if (bool
= !bool)`.

Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180830/f5ea9bc3/attachment.html>


More information about the es-discuss mailing list