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