Open In App

Strict Inequality(!==) Comparison Operator in JavaScript

Last Updated : 23 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

JavaScript Strict Inequality Operator is used to compare two operators and return true if they both are unequal. It is the opposite of the Strict Equality operator but like the Strict Equality Operator, it also does not perform type conversion.

Syntax:

a!==b

Example 1: In this example, we will use the inequality operator on the same data types.

Javascript




let a = 2; b=2, c=3;
let d = {name:"Ram"};
let e = {name:"Ram"};
let f = e;
  
console.log(a!==b);
console.log(a!==c);
console.log(d!==e);
console.log(f!==e);


Output: Since the objects, d, and e contain the same value but have different references so true is returned but objects f and e have the same reference so false is returned.

false
true
true
false

Example 2: In this example, we will use the strict inequality operator on different data types.

Javascript




let a = 2;
let b="2";
let c = true;
let d = null;
let e = undefined;
  
console.log(a!==b);
console.log(a!==c);
console.log(d!==e);


Output:

true
true
true

Supported Browsers:

  • Chrome
  • Edge
  • Firefox
  • Opera
  • Safari

We have a complete list of JavaScript Comparison Operators, to check those please go through, the JavaScript Comparison Operator article


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads