Hello, == and === operator difference very confusing. today I am explaining you difference between == vs === in javascript. we can use both operator for comparison.
==(Double Equals Operator) | === (Triple Equals Operator) |
---|---|
It will used when compare variables or values. | It will also used when compare variables/values. |
It is use when we are unsure about the data type of variable/values. | It is use when you sure about the data type of variable/values and want to strict comparison. |
(==) do not check the data type of variable/value while making comparison. | (===) check the data type of a variable while making comparison. |
’25’ == 25 it will return true because double equals don’t check the data type. | ’25’ === 25 it will return false because triple equals compare the data type too. |
250 == “250” // true | 250 === “250” // false |
50 == 50 // true | 50 === 50 // true |
Hello, Welcome to webdeveloperindia.in. I am a full-stack web developer. Email – [email protected] | Skype – azaruddin23. I have knowledge of PHP, Laravel, Magento 1/2, Codeigniter, WordPress, Joomla, Shopify, Git, Bitbuket, jQuery, Ajax, Javascript and ReactJS.