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
  • Ravi Patel
    Jan, 2020 12

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

    • 3
  • Jignesh Kumar
    May, 2020 3

    I have very good explaied artificial on =, ==, === in Java script. https://www.c-sharpcorner.com/article/difference-between-and-in-javascript2/

    • 2
  • 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.

    • 2
  • 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’

    • 2
  • Roshni Gandhi
    Jan, 2020 8

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

    • 2
  • Munib Butt
    Apr, 2020 28

    This is a very standard question for javascript. The answer is as below:

    1. == will compare the values of the two operands
    2. === will compare the values and types of the two operands

    • 1
  • Jignesh Kumar
    Apr, 2020 1

    = is used for assigning values to a variable in JavaScript.
    == is used for comparison between two variables irrespective of the datatype of variable.
    === is used for comparision between two variables but this will check strict type, which means it will check datatype and compare two values.

    My Article to understand with example.
    https://www.c-sharpcorner.com/article/difference-between-and-in-javascript2/

    • 1
  • Vinay Singh
    Apr, 2020 1

    == this will compare value only
    and === will compare value as well as type

    • 1
  • Salman Beg
    Mar, 2020 31

    Follow this video which explain clearly,

    https://www.youtube.com/watch?v=S7p9QStPUGo

    • 0

Most Popular Job Functions


MOST LIKED QUESTIONS