JavaScript comparison operators

Source: Internet
Author: User

Comparison operators: ">" "<" ">=" "<=" "= =" "! =" "= = =" "!=="

1. The operator is normally compared on both sides of the number;

2. All strings are converted to ASCII comparison (the first letter, the same as the next comparison, until the size);

3. In the case of numeric and string comparisons, try to convert the string (here is an implicit call to the number conversion string instead of converting the string to an ASCII value) and false if the result is not converted;

4.undefined comparison with any type of data the return result is false

Undefined with any numeric calculation returns the result is Nan

5. Determine whether two objects are equal compared to the memory address pointed to by the pointer.

For example:

var obj1={name: ' Zhangsan ', Age:18};var obj2={name: ' Zhangsan ', Age;18};console.log (OBJ1==OBJ2);

The output is false because Obj1 and OBJ2 have different addresses in memory.

I know about JS is still shallow, if there are errors, please correct me, thank you!

JavaScript comparison operators

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.