Comparison operation = and! = To check whether two expressions are equal, as first converts them to the same data type, and then judges whether the two values are equal, "6" and "6" are equal, because the string "6" is converted to the 6 trace (5 = 6) of the number; // displays: falsetrace (6 = 6); // displays: truetrace (6 = "6"); // displays: truetrace (5 = "6"); // displays: false if strict data check is disabled, strict comparison is still required. You can use strict equality and inequality operators, ===and! =. Before comparing these operators, check whether the values have the same data. The reason for the Data Type difference, so = returns the straight value ,! === Returned false trace (6 === 6); // displays: truetrace (6 === "6"); // displays: falsetrace (6! = 6); // displays: false
Trace (6! = "6"); // displays: True
Use is to check the data type of the Variable
VaR quantity: Int = 5;
If (quantity is int ){
Trace ("Yippee. It's an integer .");
}
When an expression cannot be calculated, the variable is an invalid number. Nan is short for not a number. Nan is also a number.
VaR quantity: Number = 15-"rabbits ";
Trace (typeof quantity); // displays: "Number"
How to test whether the variable is Nan and use the isnan () function
VaR quantity: Number = 15-"rabbits ";
If (isnan (Quantity )){
Trace ("Sorry, that is not a valid number .");
}
When comparing composite objects, compare whether the reference addresses of objects are the same