## Javascript compare with strict inequality operator

In Javascript we use the strict inequality operator to check if a particular condition passes or fails.

It is exactly opposite of the equality operator we've covered. If equality operator returns true, the inequality operator would return false.

Let's take a look at an example to understand this. Here, we are checking if the numbers are strictly equal or not. In the first instance five is not equal to string 5. Thus the result is true. In the second insance, both the numbers are equal. Thus returns false.

<!DOCTYPE html>

<html>

<body>

<button onclick="sinequality(5,'5')">Check if 5 !== '5'</button>

<button onclick="sinequality(5,5)">Check if 5 = 5</button>

<p id="result"></p>

<script>

var x = document.getElementById("result");

function sinequality(num1, num2) {

if(num1 !== num2){

x.innerHTML = true;

}

else{

x.innerHTML = false;

}

}

</script>

</body>

</html>

## 0 Comments