0 reply content: ===determine whether the values and types are equal
= Judge whether the value is equal
For example
0 = false returns true because type conversion is performed first and their values are equivalent.
While
0 = false returns false because they have different connection types. I think the = and = in JS are equivalent to the = and equals in java, and the is and = in python. The former is used to determine whether the value is the same, and the latter is used to determine whether the value is the same ". ===Is equal to the type and value, without type conversion
= Is equal to the value. If the type can be converted, the automatic type conversion means that the values are equal.
X = y because there may be cross-type comparisons, it is rarely used. Three = The names are absolutely equal. They are more strict and equal than =. In js, = is more common. is the main author coming to show his own browser? Page 52 of javascript advanced programming, equal operators.
To maintain the integrity of the code data type, we recommend that you use full and incomplete operators.
Just remember the concept and pay more attention when using it. For example, in the swich statement, all operations are used instead of equal operations. = Is equal to the operator. During comparison, type conversion is forced. = is strictly equal to, and type conversion is not forced. From the perspective of performance and code specifications, it is not recommended to use =. Even if type conversion is required, you should first display the conversion and then use =.
Example:
0 = ""
0 = "0"
"" = "0"
What are the results?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service