When you look at the Ext source code, you may encounter "=" 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>