=== without conversion 1. same type and 2. same vaule
| comments | Javascript source | Execution result in your current browser |
|---|---|---|
| integer and float, same type | var code= "1 == 1.0";
document.write(code+" eval to: "+eval(code));
code="1===1.0";
document.write("<br/>"+code+" eval to: "+eval(code));
|
|
| number and string | code="1=='1'";
document.write("<br/>"+code+" eval to: "+eval(code));
code="1==='1'";
document.write("<br/>"+code+" eval to: "+eval(code));
|
|
| string and object | var obj=new Object();
document.write(obj);
code="'[object Object]' == obj";
document.write("<br/>"+code+" eval to: "+eval(code));
code="'[object Object]' === obj";
document.write("<br/>"+code+" eval to: "+eval(code));
|
|
| null and undefined | var b; //not defined;
code="b==null";
document.write("<br/>"+code+" eval to: "+eval(code));
code="b==undefined";
document.write("<br/>"+code+" eval to: "+eval(code));
code="b===null";
document.write("<br/>"+code+" eval to: "+eval(code));
code="b===undefined";
document.write("<br/>"+code+" eval to: "+eval(code));
|