After reading ext's Source code And "! = "For a moment, I cannot understand the meaning of each of them.
Haha, it seems that there is a network that is really convenient :)
Reference
· Constant equals (=): checks whether the two operands are the same, that is, checks whether the values of the operands without data type conversion are equal.
· Non-constant equals (! =): Check whether the values of the two operands are different before data conversion.
The following is an excerpt from the discussion record:
Fengyan 09:24:01
If (index! =-1 ){
...
}
What does it mean? Who knows?
Pedestrians on the road 09:26:32
=== Constant equals ..
Pedestrians on the road 09:26:41
! = Not constant equals ..
Fengyan 09:33:58
Haha, according to the "constant equals" of pedestrians on the road, I searched:
3. Use the constant equals and non-constant equals operators (= and! ===)
1) check whether the values of the two variables are equal and do not perform any conversion. For example, if 2 = "2" is not true, false is returned.
Fengyan 09:34:13
<SCRIPT type = "text/JavaScript">
<! --
Alert (2 = "2 ");
Alert (2 = "2 ");
Alert (2! = "2 ");
// -->
</SCRIPT>
Fengyan 09:36:32
Hey, here's the details:
· Constant equals (=): checks whether the two operands are the same, that is, checks whether the values of the operands without data type conversion are equal.
· Non-constant equals (! =): Check whether the values of the two operands are different before data conversion.
Pedestrians on the road 09:39:41
If (index! = 1) What does it mean ??
Fengyan 09:43:04
Index! = 1
Equivalent:
! (Index = 1)
Fengyan 09:43:10
This should be the case.
Fengyan 09:43:18
Try me
Fengyan 09:44:07
<SCRIPT type = "text/JavaScript">
<! --
VaR A = (2! = "2 ");
VaR B =! (2 = "2 ");
Alert (A = B );
// -->
</SCRIPT>
Fengyan 09:44:40
2 = "2" requires the same data type
Fengyan 09:44:45
Returns true
Z 09:49:30
Yes
Z 09:49:44
If the two values have different types, they are not identical.
Z 09:51:52
= Convert both numbers into char and then compare the values.
===Is to first compare whether the types are the same
Fengyan 09:54:42
The test is true.
<SCRIPT type = "text/JavaScript">
<! --
VaR O1 = {A: ""};
VaR O2 = o1.tostring ();
Alert (O1 = O2 );
Alert (O1 = O2 );
// -->
</SCRIPT>