User Guide
Operators 173
!== strict inequality operator
expression1 !== expression2
Tests for the exact opposite of the strict equality (=== )operator. The strict inequality operator
performs the same as the inequality operator except that data types are not converted.
If
expression1 is equal to expression2, and their data types are equal, the result is false.
As with the strict equality (
===) operator, the definition of equal depends on the data types
being compared, as illustrated in the following list:
■ Numbers, strings, and Boolean values are compared by value.
■ Objects, arrays, and functions are compared by reference.
■ A variable is compared by value or by reference, depending on its type.
Availability: ActionScript 1.0; Flash Lite 2.0
Operands
expression1 : Object - A number, string, Boolean value, variable, object, array, or
function.
expression2 : Object - A number, string, Boolean value, variable, object, array, or
function.
Returns
Boolean - The Boolean result of the comparison.
Example
The comments in the following code show the returned value of operations that use the
equality (
==), strict equality (===), and strict inequality (!==) operators:
var s1:String = "5";
var s2:String = "5";
var s3:String = "Hello";
var n:Number = 5;
var b:Boolean = true;
trace(s1 == s2); // true
trace(s1 == s3); // false
trace(s1 == n); // true
trace(s1 == b); // false
trace(s1 === s2); // true
trace(s1 === s3); // false
trace(s1 === n); // false
trace(s1 === b); // false
trace(s1 !== s2); // false
trace(s1 !== s3); // true
trace(s1 !== n); // true
trace(s1 !== b); // true