! = and! == What is the difference in JavaScript?

JavaScript includes operators like in other languages. An operator performs some operations on one or more operands (data values) and produces a result. Today's article will help readers learn about 2! = And! == operators in JavaScript.

JavaScript includes operators like in other languages. An operator performs some operations on one or more operands (data values) and produces a result. For example 1 + 2 , where + is the operator and 1 is the left operand and 2 is the right operand. The + operator adds two numeric values ​​and produces a result of 3 in this case.

Today's article will help readers learn about 2 ! = And ! == operators in JavaScript.

Operator! =

The inequality ( ! = ) Operator is the opposite of the equality ( == ) operator. It means 'Not Equal' and returns True , when equality returns False and vice versa.

Like the == operator, the ! = Operator will convert data types of values ​​while comparing.

Example 1! = '1' will return False because the data type conversion took place and 1 and '1' are considered equal.

Operator! ==

The strict inequality ( ! == ) operator is the opposite of the strict equality operator ( === ). It means 'Strictly Not Equal' and returns True when strict equality returns False and vice versa.

Like the === operator, the ! == operator will not convert data types.

Example 1! == '1' will return True because 1 is an integer and '1' is a character and no data type conversion takes place.

Illustration:

 

Output:

! = and! == What is the difference in JavaScript? Picture 1
Example output
5 ★ | 1 Vote | 👨 145 Views
« PREV POST
NEXT POST »