Is there a really easy way to toggle a boolean value in javascript?

So far, the best I’ve got outside of writing a custom function is the ternary:

bool = bool ? false : true;

8 s
8

Leave a Reply

Your email address will not be published. Required fields are marked *