JS: all called: JavaScript. is the scripting language in the Web page.
Code embedding:
<script type="text/javascript"></script>
Try to write it down.
Basic knowledge:
All the characters are in English half-width.
In most cases, a semicolon is added after the end of each statement.
Add a newline after each piece of code ends.
The program echoes (preceded by a parenthesis "(" There must be a parenthesis ending ")").
Comment Syntax:
/* * * Multiple lines of comments.
Single-line comment.
Output syntax:
Alert (Info): Popup message.
Confirm (info): POPs up a dialog box that interacts with the user.
Prompt (info): POPs up a Text dialog box to enter content.
Console.log (Info): output in console.
Data type:
The data is stored in the program, and the stored name is called a variable.
It is divided into strong type language and weakly typed language.
strongly typed languages : The data storage needs to be stored in the corresponding data type variables.
Parameters : Integer (integer) int
Single Precision fractional float
Double-precision Decimal double
Fractional decimal
Currency type Money
Character Char
Strings string
boolean bool (only two states) true false true.
Date Time type DateTime.
Weakly typed languages : When data is stored, the type is not distinguished (type Auto-conversion).
Variable definition:
var a=10
If a variable with a decimal or integer is defined, the value is written directly after the equal sign.
If you define a string variable, the value after the equals sign needs double or single quotation marks
e.g. a= "hello,world!"
type transition:Parse (the type that will be converted).
An operator expression:
mathematical operators : Plus +; minus-; multiply *; remove/; take the remainder%.
logical operators :&& and; | | or;! Non -.
comparison operators : judging whether equal = =;
Not Equal! = or <>.
Greater than >.
Less than <.
is less than or equal to <=.
Greater than or equal to >=.
Other:
concatenation between strings with +. E.g.:alert ("Hello" +aa+ "world" + "!").
Ternary operators:
A==b? " A equals B ":" A is not equal to B "
Determine if they are equal.
Write a Boolean data directly.
JS Basic syntax