Use ===
to equate the variables instead of ==
.
==
checks if the value of the variables is similar
===
checks if the value of the variables and the type of the variables are similar
Notice how
if(0===false) {
document.write("oh!!! that's true");
}?
and
if(0==false) {
document.write("oh!!! that's true");
}?
give different results