filmov
tv
javascript - How to toggle a boolean?
![preview_player](https://i.ytimg.com/vi/WZPFVDq7qeg/maxresdefault.jpg)
Показать описание
#short
#javascript
#boolean
#toggle
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;
#javascript
#boolean
#toggle
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;