A break is to break out of the current loop and stop executing the statement in the loop. A break is to break out of the parent loop of one layer and continue the nesting of the outer layers. var text=”sss” var isInSnake=true while(isInSnake){ for(var i=0; i<3; i++){ for(var n=0; n<3; N++){// break for(var I =0; i<3; I++), If (text==” SSS “){console.log(“isInSnake=true”) break //} console.log(“break1”)} console.log(“break2”)} isInSnake=false console.log(“break3”) }

A continue function is similar to a break, except that a continue only terminates the loop and then begins the next loop, that is, the loop continues again, only terminating this time. While (isInSnake){for(var I =0; i<3; i++){ for(var n=0; n<3; N++){if(text==” SSS “){console.log(“isInSnake=true”) continue //continue Log (“continue1″)// console.log(” DDDDDDDDDD “) will not be executed} console.log(“continue2”)} isInSnake=false console.log(“continue3”) } console.log(“continue4”)

While (isInSnake){// Set a small box for(var I =0; i<3; i++){ for(var n=0; n<3; N++){if(text==” SSS “){console.log(“isInSnake=true”) return Log (“return1”)} console.log(“return2”)} isInSnake=false console.log(“return3”)}