JS data type implicit conversion notes and JS wrapper objects

Source: Internet
Author: User
Tags string to number

"37" +7//377

"37"-7//30

Skillfully use +/-rules to change the string x+ ' variable number x-0

JS inside the = = is not strictly equal to

"123" = = 123

0 = = False

Nul l== undefined

New Object () = = new Object ()

[1,2]==[1,2]

But [1,2]===[1,2] is wrong because the reference to the object is compared

Ps:nan values are not equal to anything, even if they are not strictly equal to

———————————————————————————— a==b ————————————————————————————————

If the type is the same, same as = = =

Type not at the same time

Number==string string to number before comparing

boolean==? Boolean Go first number

Object==string|number attempt to convert object to base type other then False

JS Wrapper Object

var str= "123"; alert (str.length); The result is 3 (obviously the string type is not an object, why can I call the Length property?) )

str.t=3;

alert (STR.T); The result is undefined (why can't it be 3 here)

Explanation: By Mu class bosn teacher

JS data type implicit conversion notes and JS wrapper objects

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.