JavaScript basic syntax

Source: Internet
Author: User

Create the 1~4 section folder before creating the HTML file:

Section One: How JavaScript is introduced

First introduce the internal introduction of two methods: JS script in

JS script must be wrapped in <srcipt></script> inside: first included in head

Operation Result:

Contained inside the body:

Operation Result:

The next step is the external introduction method:

Create JS file in SEC01: Project right-new file

Inside write:

Next introduce Myjs.js:

Operation Result:

If garbled, the property's character property may be incorrect:

Can join: CharSet and properties of the encoding like, otherwise garbled. It is best to unify into UTF-8, garbled and modified code .

2. JavaScript Comments:

Single-line Comment://

Multiline Comment:/* */

3. JavaScript variables:

JavaScript is a weak language type and uses var to define variables (any).

Description: JS has a garbage collection mechanism, a from 1 into a string, then 1 will be destroyed immediately.

There is no type of strict meaning.

Define variables and assign values directly below:

4. JavaScript Basic Data type:

Strings Support "", "" (English input state) both can.

Next write the value, String, Boolean type:

Results:

Next comes the 2 special:

1, Undefined:

2. Empty the variable:

JavaScript basic syntax

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.