javascript:goto 语句
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14335353/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 21:20:41 来源:igfitidea点击:
javascript: goto statement
提问by Ashok Damani
I have a for loop, but in one condition, I want to skip some steps so that I have used goto
statement...
我有一个 for 循环,但在一种情况下,我想跳过一些步骤,以便我使用goto
语句...
for (var rows = 0; rows < result.data.length; rows++) {
[lbl] topOfLoop:
var row = result.data[rows]
if (row[0] == "") {
goto topOfLoop;
}
----- // some code
}
Its not working ? Can anyone tell me, how it could be done ?
它不工作?谁能告诉我,怎么做?
回答by Habib
回答by andlrc
Pretty sure you want to use continue;
:
很确定你想使用continue;
:
for (var rows = 0; rows < result.data.length; rows++) {
var row = result.data[rows];
if (row[0] == "") {
continue;
}
// some code
}