Перевернуть флажок в JavaScript

checkbox.checked = !checkbox.checked;
Clever Cardinal