JS Depth 1

Source: Internet
Author: User

1.JS Data types

1.1 +-arithmetic logic

var x= "The answer is" +42; The answer is 42

var y=42+ "is the answer";//Is the answer

But

var z= "37"-7; 30

var s= "is the answer"-42; 0;

You can use the +-sign to convert the data type. string-0---> Numeric string+0---> Character type

1.2 = = Arithmetic

    • "1.23" ==1.23//Converts a string to a number and compares it
    • 0==false//Converts the Boolean value false to number 0 and then compares
    • null==undefined//
    • New Object () ==new object ()//false?
    • [1,2]==[1,2]//false?

1.2.1 strictly equals = = =

First, the data types on both sides of the = = = are determined, and the type is different, returning false directly. Is the same type, the value is compared.

Null===null

undefined===undefined

Nan!=nan this NaN and any numerical comparison are unequal, and compared to their own.

1.3 Packaging Objects

JS Depth 1

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.