Difference between != and !== operator in JavaScript Last Updated : 29 Dec, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report != operatorThe inequality operator (!=) is the logical opposite of the equality operator. It means "Not Equal" and returns true whereas equality would return false and vice versa. Like the equality operator, the inequality operator will convert data types of values while comparing. For example 1 != '1' will return false since data type conversion takes place so 1 and '1' are considered equal. Example: Below example shows != Operator. JavaScript console.log(" 1 != '1' " + (1 != '1')); console.log(" 1 != 1 " + (1 != 1)); console.log(" 1 != '2' " + (1 != '2')); Output 1 != '1' false 1 != 1 false 1 != '2' true !== operatorThe strict inequality operator (!==) is the logical opposite of the strict equality operator. It means "Strictly Not Equal" and returns true whereas strict equality would return false and vice versa. Strict inequality will not convert data types. For example 1 !== '1' will return true since 1 is an integer and '1' is a character and no data type conversion takes place. Example: Below example shows !== Operator. JavaScript console.log(" 1 !== '1' " + (1 !== '1')); console.log(" 1 !== 1 " + (1 !== 1)); console.log(" 1 !== '2' " + (1 !== '2')); Output 1 !== '1' true 1 !== 1 false 1 !== '2' true Difference between != and !== operator in JavaScriptFeature!= (Loose Inequality)!== (Strict Inequality)Type CoercionConverts values to the same type for comparison.Compares values without changing their types.Example5 != "5" is false5 !== "5" is trueUsage RecommendationUse with caution as it may lead to unexpected results due to type coercion.Preferred in most cases to ensure both value and type are considered. It's more explicit and reduces the chance of unexpected behavior. Comment More infoAdvertise with us Next Article Difference Between == & === in JavaScript R ranadeepika2409 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Similar Reads Difference Between && and || Operators in javaScript In JavaScript, logical operators && (AND) and || (OR) are used to perform the logical operations on values. These operators are commonly used in the control flow and decision-making within the programs. Understanding the differences between these operators is essential for writing efficient 2 min read Difference Between == & === in JavaScript In JavaScript, comparison operators like == (double equals) and === (triple equals) are used to compare values, but they behave differently. The == operator is known as the loose equality operator. It compares two values for equality after performing type coercion, meaning it converts the values to 3 min read Difference between the (=), (==), and (===) operators in PHP In PHP, the '=' operator is used for assignment, while the '==' operator is used for loose equality comparison, meaning it checks if two values are equal without considering their data types. On the other hand, the '===' operator is used for strict equality comparison, meaning it checks if two value 3 min read What is the difference between == and === in PHP ? In this article, we will discuss the differences between '==' and '===' operators in PHP. Both are comparison operators used to compare two or more values. == Operator: This operator is used to check the given values are equal or not. If yes, it returns true, otherwise it returns false. Syntax: oper 2 min read Difference between a || b < 0 and a < 0 || b < 0 in JavaScript ? Both expression almost looks the same when we focused on the || (Or) operator, but both expressions are different from each other. To know the final conclusion, we have to get the knowledge of the || (Or) operator first. JavaScript || (Or) Operator: The âORâ operator is the opposite of the âANDâ ope 2 min read JavaScript in and instanceof operators JavaScript Relational Operators are used to compare their operands and determine the relationship between them. They return a Boolean value (true or false) based on the comparison result.JavaScript in OperatorThe in-operator in JavaScript checks if a specified property exists in an object or if an e 3 min read Like