Possible Duplicate:
JavaScript === vs == : Does it matter which “equal” operator I use?
I asked another question here and received a great answer as follows:
$(document).on("keydown", function (e) {
if (e.which === 8 && !$(e.target).is("input, textarea") || $(e.target).is('[readonly]')) {
e.preventDefault();
}
});
Notice the three equal signs ===
in the if-statement. I have always thought you only needed two equal signs ==
for a javascript/jQuery if-statement. Is there any reason for the three?
UPDATE
Sorry for the duplicate question - I searched but didn't find any good questions. I guess I was using the wrong search terms.