HTML and CSS Reference
In-Depth Information
Table 5.7 Equality Test with Strings and Numbers (continued)
Test
Are They Equal?
false == false
true
true == 1
true
null == undefined
true
Figure 5.8 Testing the equality of two strings. Is "William" equal to "william" ? Nope.
What Is Identical? Men are equal; clones are identical. The === and !== equality
operators test that its operands are not only of the same value, but also of the same data
type. String “54” is equal to number 54 , but not identical because one is a string and the
other is a number, even though their values are equal. See Table 5.8.
Table 5.8 Identity Test with Strings and Numbers
Test
Are They Identical?
"William" === "William"
true
"william" === "William"
false
5 === 5.0
true
"54" === 54
false
NaN === NaN
false
null === null
true
-0 === +0
true
false === false
true
true === 1
false
null === undefined
false
 
Search WWH ::




Custom Search