Jaimin Shethiya
What is the difference between == and === in javascript?

== means only compare the value. if you have to used only == equal and they don’t checked the any datatype. if the datatype mismatch then also it will return true.
=== means compare value with the datatype also if both are same then it will return true otherwise it will return false.

By Jaimin Shethiya in JavaScript on Jan 01 2020
  • Roshni Gandhi
    Jan, 2020 8

    == compares the value === compares value and type

    • 2
  • Ravi Patel
    Jan, 2020 12

    == compares the value
    === compares value and type

    • 1
  • chaitanya phadnis
    Jan, 2020 10

    1. == and === is use for comparaing object
    2. == is check abstract equality like chanking only values for both side
      if(2 == ‘2’) - true.
    3. === is compare data type and value ex.
      if(2 === ‘2’) - return false as one variable is int and another is ‘string’

    • 1
  • Siddharth Gajbhiye
    Jan, 2020 17

    This is very common interview question in javascript most of the interviewer asked this kind of question the very basic example is

    1 == ‘1’ The result of this answer is true because when we compare two values using double equal then it comapares only value but 1 === ‘1’ this gives us false because this time not only checkes the value but its data type also.

    • 0

Most Popular Job Functions

MOST LIKED QUESTIONS