This article mainly introduces the differences between "" and "" in Javascript, which is very comprehensive. we recommend this article to our friends when using JavaScript, from time to time, you may encounter the use of the = and = symbols to determine whether the two variables are equal. However, the differences between the two symbols have not been investigated. Today I met the = symbol, so I decided to check the difference between the two.
In Javascript, there are two comparison operators: "=" and "=". what are their differences?
1. for basic types such as string and number, ==and ===are different
1) compare different types, = to compare "convert to the value of the same type" to see if "value" is equal, = if the type is different, the result is not equal
2) compare the same type and directly compare the values. The results are the same.
2. for advanced types such as Array and Object, there is no difference between ==and ==
When a variable is defined as Arrary and a variable is defined as the Object type, but its value is the same, the result of the comparison of = and = is the same, because it is used for "pointer address" comparison
3. the basic and advanced types, ==and ==are different
1) For =, convert the advanced type to the basic type for "value" comparison
2) the result of ===is false because of different types.