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
  • Atul Warade
    Jun, 2020 19

    In JavaScript it means Same value and type. For Example, 5 == "5" // It will return true because it evaluate the same value 5 === "5" // It will return false because it evaluate both same value as well as same type.Hope this will resolve your query.

    • 1
  • Muskan Jain
    Jun, 2020 5

    == Just compares the value. Whereas, === compares the value as well as its datatype. If the data type and value both matches then only it will be true, else will return false.

    • 1
  • 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
  • kiran kumar
    Jul, 2020 7

    both are same functions except === compares the value and datatype so when validate 3==="3" return false because value same but data type string

    • 0
  • 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