JavaScript Advanced Programming 3rd Edition-study notes-1

Source: Internet
Author: User
Tags cdata

P1-P30 page

1. Properties of <script> Tags

Async:async (HTML) | async= "Async" (XHTML), which means that the script is downloaded immediately, but not executed immediately (execution is not in order) and the build document is not paused.

Defer:defer (HTML) | Defer (XHTML), which means that the script is downloaded immediately, but deferred until the

2. Embed JS code in XHTML plus CDATA

<script>//<![ cdata[...    code     ... if (A < b) {        ... code ...     }     // ]]</script>

In XHTML, a < b is interpreted as a new label, but there is no space after,< as a label, so there is a syntax error, so in order to solve this problem, it is best to introduce CDATA fragments, but with browser-compatible XHTML, which does not support CDATA, So comment out the CDATA tag.

3. Using "Use strict" to turn on strict mode of parsing engine

4. Omit the var operator to define global variables, but it's best not to do so

5. Automatic Boolean type conversion

1 var message = "Hello"; 2 if (message) {3    console.log (message); 4 }

The IF (message) here is equivalent to if (a Boolean (message))

6, IEE754 numerical floating point calculation of common problems, see blog 0.1+0.2!=0.3, why? How to solve? --simple discussion on the floating point arithmetic of javascript

JavaScript Advanced Programming 3rd Edition-study notes-1

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.