Equality

  • Updated
Operator Compatible types Description
== 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.

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.