Basic syntax for JS scripting language

Source: Internet
Author: User
Tags true true

The basic syntax of the JS scripting language: Output Syntax alert ("Warning!");   Confirm ("OK?"); Prompt ("Please enter password"); for weakly typed language;

To embed the JS code at the beginning: <script type= "Text/javascript" ></script>;

The basic syntax to note about writing a program is: 1. All characters are in English half-width; 2. In most cases, a semicolon is added after the end of each statement; 3. Add line after each piece of code, 4. Procedure then;

JS is a weakly typed language, and the data is stored in a non-differentiated type (type auto-conversion);

JS Common data types: integer (integer) int, single-precision fractional float, double-precision fractional double, decimal decimal, Boolean bool (can only save two states) <true true false >;

where characters char (not commonly used) and string strings (not commonly used) are data in strongly typed languages.

What to note about defining variables: 1. If you define a variable of integer or decimal, the value after the equal sign is written directly; for example: var a = 10; float B = 10.5;

2. If you define a string variable, the value after the equals sign needs to be double or single quotation marks; for example: string s = "Hello";

Basic syntax for JS scripting language

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.