One: Basic data types:
String, Decimal, Integer, DateTime, Boolean
Two: Variables
are generic type Var, can store other types of values, can be used directly, not defined, but is customary to define.
Define variables: var A: All variable definitions are defined with Var, var is a generic mutable type.
Three: type conversion
It is divided into automatic conversion and casting, which is generally used for casting.
Other types converted to integers: parseint ();
Other types converted to decimals: parsefloat ();
In addition to determine whether it is a valid number type: IsNaN ();
Four: operator
Math operator: +-/% + +-;
Relational operators: = =! = >=< <=;
Logical operator:&& | | !;
Five: statement
Generally divided into sequential, branching and looping statements
(1) Branch if statement
if (judging condition) {The statement that satisfies the condition to be executed}else{the statement that the condition is to be executed}
(2) Loop for statement
for (initial condition; cyclic condition; state change) (loop body)
VI: Array
Definition of the array: the new Array (); his length is dynamic, which can be placed in any type of element.
Assignment of array elements: a[0]=123; A[1]= "";
Array value: A[i]:
Array properties: A.length: Number of array elements, length.
Seven: Functions
The function in JS is the same as the four elements in C #.
Define functions: Function ... () {function Body}, ... As the function name, the input is the form of a parameter, and the return value can be either a var type or a return value.
Functions that do not call are not executed.
Basic syntax for JavaScript