在" continue"或" break"语句及其Label名称之间不允许使用换行符。
outerloop: //This is the label name for (var i=0; i < 3; i++) { console.log("Outerloop: " + i); for (var j=0; j < 5; j++) { if (j == 3){ continue outerloop; } console.log("Innerloop: " + j ); } }
成功执行上述代码后,将显示以下输出。
Outerloop: 0 Innerloop: 0 Innerloop: 1 Innerloop: 2 Outerloop: 1 Innerloop: 0 Innerloop: 1 Innerloop: 2 Outerloop: 2 Innerloop: 0 Innerloop: 1 Innerloop: 2
参考链接
https://www.learnfk.com/es6/es6-label-with-continue.html
标签:outerloop,Outerloop,Innerloop,console,continue,无涯,Label,Continue From: https://blog.51cto.com/u_14033984/9507103