What is === in javascript?

Possible Duplicate:
Javascript === vs == : Does it matter which “equal” operator I use?

Looking into the answer of Chris Brandsma in Advanced JavaScript Interview Questions what is === in Javascript.

If possible please provide a simple example


=== is the strict equal operator. It only returns a Boolean True if both the operands are equal and of the same type. If a is 2, and b is 4,

a === 2 (True)
b === 4 (True)
a === '2' (False)

vs True for all of the following,

a == 2 
a == "2"
2 == '2' 

=== is 'strict equal operator'. It returns true if both the operands are equal AND are of same type.

a = 2
b = '2'
a == b //returns True
a === b //returns False

take a look at this tutorial


请参阅严格平等检查..

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

上一篇: 什么时候应该在javascript中使用=== vs ==,!== vs!=等等..

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