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