Difference between double equal vs triple equal JavaScript Last Updated : 06 Jan, 2023 Comments Improve Suggest changes Like Article Like Report Double equal: The double equal('==') operator tests for abstract equality i.e. it does the necessary type conversions before doing the equality comparison. Triple equal: The triple equal('===') operator tests for strict equality i.e it will not do the type conversion hence if the two values are not of the same type, when compared, it will return false. Example 1: In this example, we will check abstract and strict quality. One will return true between a string 9 and number 9. Because there is no type comparison, in the case of '===' it will return false. JavaScript <script> // In R.H.S. string "9" is converted into // number 9, hence returns true. console.log(9 == "9"); // Here no type of conversion takes place, // hence returns false console.log(9 === "9"); </script> Output: true false We have an article on JavaScript ‘===’ vs ‘==’ Comparison Operator, you can go through that article for in-depth information. Example 2: Here L.H.S. is a string literal whereas R.H.S. is a string object, due to the type conversion of a string object into a string literal, it returns true. JavaScript <script> // type conversion takes place console.log("GeeksforGeeks" == new String("GeeksforGeeks")); // No type of conversion takes place console.log("GeeksforGeeks" === new String("GeeksforGeeks")); </script> Output: true false Example 3: Here number 1 is converted into true(boolean type) in javascript true is referred to as 1 and false is referred to as 0, hence it returns true. JavaScript <script> // type conversion console.log(true == '1'); // No type conversion so it returns false console.log(true === '1'); </script> Output: true false In general "===" operator is recommended since it never does type conversion we are doing an exact comparison thus it always produces correct results. Comment More infoAdvertise with us Next Article Difference between double equal vs triple equal JavaScript S SARANYA_JENA Follow Improve Article Tags : JavaScript Web Technologies Web Technologies - Difference Between Similar Reads 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 && 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 != and !== operator in JavaScript != 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 != 2 min read What is the difference between every() and some() methods in JavaScript ? In this article, we will see the difference between every() and some() methods in JavaScript. Array.every() methodThe Array.every() method in JavaScript is used to check whether all the elements of the array satisfy the given condition or not. The output will be false if even one value does not sati 3 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 Like