JavaScript basic Syntax (introduction, script tag, strict mode, reserved word keyword)

Source: Internet
Author: User
Tags script tag

Introduction
[1] Definition: A scripting language designed to interact with Web pages, which is interpreted programming language.
[2] Composition:
[2.1] ECMAScript is defined by ECMA-262 and provides core language functionality (ECMA is the European Association of Computer Manufacturers)
[2.2] DOM Document Object model, an interface that provides methods for accessing and manipulating Web page content
[2.3] The Bom Browser object model, which provides an interface for methods that interact with the browser

"Script Tag"

[1] How to use: Introduce external files and embed JS code inside the page
[2] Note: The <script> element with the SRC attribute should not contain additional JS code between its <script> tags, and if it contains embedded code, it will only download and execute the external script, ignoring the embedded code
[3] The browser only starts rendering content when it encounters a <body> tag. Therefore, putting the <script> reference behind the page content in the <body> element is the best choice
The async attribute in [4]<script> indicates that the script should be downloaded immediately, but should not interfere with other actions on the page; The Defert property indicates that the script can be deferred until the document is fully parsed and displayed before execution (both properties are only valid for external script files)

"Strict Mode"
[1] The entire script is enabled in strict mode, at the top of the execution: "Use strict"
[2] Execution of strict mode in the specified function, the first line of the function body: "Use strict"
[3] browsers that do not support strict mode will execute "use strict" as a string statement, and browsers that support strict mode will turn on strict mode to run JavaScript
[4] A browser that supports strict mode includes ie10+, firefox4+, safari12+, opera12+, Chrome

"keywords and reserved Words"

[1] Keywords
Break | do| Instanceof| typeof | Case | else | New | var | Catch | Finally | return | void | Continue | for | *switch | While | function | This | with | Default | If | throw | Delete | In | Try | debugger*
[2] Reserved words
Abstract | enum | int | Short | Boolean | Export | interface | static | byte | Extends | Long | Super | char | *final | Native | Synchronized | Class | float | Package | Throws | Const | goto | Private | transient | *debugger | Implements | protected | volatile | Double | Import | Public
[3] 5th edition reserved Words in non-strict mode
Class | enum | Extends | Super | Const | Export | Import
[4] 5th edition reserved words in strict mode
Implements | Package | Public | interface | Private | static | let* | protected | yield*
[Note 1] in JS, class is reserved word, not use, but should use classname. Class->classname
[Note 2] in strict mode, eval and arguments are also not available as identifiers

JavaScript basic Syntax (introduction, script tag, strict mode, reserved word keyword)

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.