Skip to main content



Equality

OperatorCompatible typesDescription
==All

Performs a value equality comparison and returns the result:

 

var x = { Name : 'Fred' };
var y = { Name : 'Fred' };
var z = x == y;
// z == true

 

If lhs and rhs are both null, the result is true. If lhs or rhs (but not both) is null, the result is false.

!=All

Performs a value inequality comparison and returns the result:

 

var x = { Name : 'Fred' };
var y = { Name : 'Fred' };
var z = x != y;
// z == false

 

If lhs and rhs are both null, the result is false. If lhs or rhs (but not both) is null, the result is true.

===All

Performs an identity equality comparison and returns the result:

 

var x = {Name: 'Fred'};
var y = {Name: 'Fred'};
var z = x === y;
// z == false

 

If lhs and rhs are both null, the result is true. If lhs or rhs (but not both) is null, the result is false.

!==All

Performs an identity equality comparison and returns the result:

 

var x = { Name : 'Fred' };
var y = { Name : 'Fred' };
var z = x !== y; // z == true

 

If lhs and rhs are both null, the result is false. If lhs or rhs (but not both) is null, the result is true.