dimanche 1 novembre 2015

Is "== true" nessecary here?

Real quick question: I used to do Java, and I know that if you were using an "if statement" to test if a boolean variable was true, you could say if ( x == true ), or just shorten it to if ( x ). My question is, I am using JavaScript to see if a radio button is checked, and I want to know if it needs to say if ( document.getElementById("x").checked == true ) or if I can just say if ( document.getElementById("x").checked ). Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire