Triple (3) Equal Signs

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.


Triple equal sign in javascript means equality without type coercion.

For example:

1=="1"     // true, automatic type coersion
1==="1"    // false, not the same type.

三个等号表示值和类型是相等的。

链接地址: http://www.djcxy.com/p/3244.html

上一篇: 什么是JavaScript中的===

下一篇: 三(3)等号