Here is how their guide went.
CODE
var chkbox = document.getElementById("mycheckbox");
if(chkbox.value == 1){chkbox.value = 0;}
else if(chkbox.value == 0){chkbox.value = 1;}
if(chkbox.value == 1){chkbox.value = 0;}
else if(chkbox.value == 0){chkbox.value = 1;}
now i don't want to get into the fact that a checkbox can only be 1 or 0 so an else if is not even necessary, but i already did
here's the optimized solution for swapping a 0/1 value or true/false in javascript
CODE
var chkbox = document.getElementById("mycheckbox");
chkbox.value ^= 1;
chkbox.value ^= 1;
simple, and more importantly efficient :)
what this does is take the value of the checkbox and XORs it by 1, that's exclusive OR, meaning 1 or the other, but not both
so if the value is 1 a XOR of 1 means they are both the same, so it evaluates to 0 aka false
if the value is 0 a XOR of 1 means they are both different, so it evaluates to 1 aka true
and there you have it, swapping checkbox values without any ifs ands, or elses
now in my work i never got the chance to use this little snippet so i thought i'd share it for any javascripters out there that might need it sometime
enjoy