1. What are expressions and statements

An expression produces a value, which can be placed wherever a value is needed and understood as an action

2. Rules for identifiers

The first character can be Unicode or $or _ or Chinese

The following characters can also have numbers in addition to those described above

3. If else statement

Syntax: if(expression) {statement 1} else {statement 2}

The most recommended way to write it:

If (expression) {statement} else if(expression) {statement} else {statement}Copy the code

4. While for statement

While syntax: while (expression) {statement}

For the grammar:

For (statement 1; Expression is 2; Statement 3) {body of loop}Copy the code

First execute statement 1 and then evaluate expression 2

5. break continue

Break: exits all loops continue: exits the current loop

6. label

Grammar:

Foo: {the console. The log (1); break foo; Console. log(' this line will not output '); } console.log(2);Copy the code