Article From:https://www.cnblogs.com/liuwujiang/p/9063936.html

##Circular statement
### whileloop

    while(Conditions)

        //Execute sentences, satisfy conditions, execute code, judge conditions, and know that they are not satisfied.

    }

### do while

    do{
    
        //Execute sentences, first, execute a statement, then enter the loop.

    }while(Conditions)
###for
    for(Initialization expression; conditional judgement expression; changing cyclic condition expression) {

        //Execution statement

    }
###foreach
    for(let i=0;i<arr.length;i++)
    {
    console.log(arr[i]);
    
    }

###Interrupt the cycle
*    `break`   //Stop the latest cycle
*    `continue`    //Terminate this cycle and carry out the next round of circulation
###Traversing two dimensional array

    let arr=[[‘a’,’b’],[‘c’,’d’],[‘e’,’f’],”123″];
    for(let  i=0;i<arr.length;i++){

    console.log(arr[i]);
    for(let j=0;j<arr[i].length;j++){
        console.log(arr[i][j]);
    }
    }

Similar Posts:

Link of this Article: JS loop statement notes

Leave a Reply

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