Article From:https://www.cnblogs.com/tydy9891-/p/9063236.html

Circular statement

**1.while**
    
    while(Conditions)
            Code executed when conditions are satisfied
               }
**2.do…while**

    do{
      Code executed
      }while(Conditions)
**3.for**

    3.1 for(Initialization expression; conditional judgement expression; changing cyclic condition expression) {
                                                   Code executed
                                                   }
    3.2 foreach
        Example: let arr=[‘1′,’2′,’3’]
        for (let i=0;i<arr.length;i++){
                                       console.log[i];
                                      }
    3.3 Interrupt the cycle
        break
        Example: for (let i=0; i< 10; i++) {
                                if(i==5){
                                        break; /continue;
        breakIt is a direct end to the whole cycle, which only interrupts the most recent cycle.
        continueAt the end of the current cycle

 

JS.First class
**1.Annotation * * *
    a.Single line commentary: double slash / middle note content / only in current row
    b.Multi line annotation: / * the comment content in the middle is / / can be many lines.
**2.Identifier * * *
    a.Hard demand
        – It can be composed of letters, numbers, underlines and dollar symbols, and no other special symbols are allowed.
        – Can’t start with numbers
        – Prohibit the use of keywords and reserved words in JavaScript
        – Strictly distinguish between case and case
    b.Soft requirement
        – Observation and knowledge
        – Hungarian nomenclature, hump nomenclature and snake nomenclature
**3.Introduction of data types * * *
    ES5
        a.String string
        b.Digital number
        c.Boolean Boole results have only true and false results
        d.Undefined undefined
        e.Empty null
    ES6Newly added
        f.Unique symbol
        g.Object object
        a-f:Basic data (simple data)
        g:Reference data (complex data)
**4.View the data type * * *
Example: console.log (typeof data);

**5.Variable * * *

Meaning: containers that store data, and data in variables can be changed.

a.Declarations of variables (created)

    ES5:
    
    Example: var a;
    
    ES6:
    
    Example: let a;
b.Variable initialization

    Example: let c=123; (giving a value at the beginning)
c.The problem of variable declarations

    – Duplication of statements
    – Omission statement
    – declaration of continuity

**6.The scope of action of a variable

    It’s the scope of the variable.
    It is divided into global scope and local scope
    ES5Local scope: partition by function
    ES6Local scope: by parenthesis
    Free variables: variables declared outside the scope, called free variables for the current scope.

**7.Variable promotion * *

    Before all code runs at once, there will be a process of parsing code (browse but not run). In this process, all variables declared through VAR will be found, and then the declaration of variables will be raised to the code head (the assignment of variables is left in the original position).

**8.Constant * * *

    Example: const a=1;
    The constant declarations must be initialized at the same time
    Not allowed to modify values
    No repeated declarations are allowed

**9.varThe difference from let * * * *

    a.varRepeated declarations are allowed, let is not allowed
    b.varScopes are distinguished by functions, and let is distinguished by parentheses
    c.varAllow variables to be raised, let is not allowed

   

Similar Posts:

Link of this Article: JS second weeks

Leave a Reply

Your email address will not be published. Required fields are marked *