Saturday, November 16, 2024
Google search engine
HomeLanguagesJavascriptStrict Inequality(!==) Comparison Operator in JavaScript

Strict Inequality(!==) Comparison Operator in JavaScript

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

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments