JavaScript 的 break 和 continue 语句
有两种特殊的语句可以在循环中使用: break 和 continue。
—————————————————————————–
Break
break 命令用来打断整个循环, 并继续执行循环后面的代码(如果有的话)。
例子
结果
| The number is 0 The number is 1 The number is 2 |
———————————————————————
Continue
continue命令将打断当前这次循环,而继续执行下一个循环值。
Example
Result
| The number is 0 The number is 1 The number is 2 The number is 4 The number is 5 The number is 6 The number is 7 The number is 8 The number is 9 The number is 10 |