![]() In the above code snippet, I have compared two variables using the = operator. If (number = "100") // Here Comparision between two values using =. This will not check datatype irrespective of datatype it will do comparision If (number = 100) // Here Comparision between two values using =. This will not check datatype irrespective of datatype it Difference between =, = and = in Javascript So it means = is not doing a strict type check. So 100=100 means both are int values, and the other condition, 100 = implies means int comparison with "100" string type of variable still returns true. In the above example, the comparison returns a true value irrespective of the datatype. ![]() If(number = "100") //Here Comparision between two values using =. This will not check datatype irrespective of datatype it will do comparision $("#lblMessage").text("Both are not equal") If (number = 100) // Here Comparision between two values using =. This will not the check datatype irrespectithe ve of datatype it will do comparision Var number = 100 // Here number variable assigned using = Let's take an example below to understand how = comparison of two variable values. It will compare irrespective ve of datatype of variableĮxample of = if (number = 100) // Here Comparision between two values using =. It will compare checks, check means it will check datatype as well. ![]() Let's take the example of each one by one.Įxample of = var number = 100 // Here number variable assigned using =Įxample of = if (number = 100) // Here Comparision between two values using =.
0 Comments
Leave a Reply. |