Javascript 什么是;勾选:“;在for循环前面是什么意思?
我今天遇到了这样一个问题:Javascript 什么是;勾选:“;在for循环前面是什么意思?,javascript,Javascript,我今天遇到了这样一个问题: check: for (var i = 0; i < versionList.length; i++) { var curVersion = versionList[i]; // find the critical ranges this version is in (the ranges only it can support) var ranges = getCriticalRanges(target.name, curVersion);
check: for (var i = 0; i < versionList.length; i++) {
var curVersion = versionList[i];
// find the critical ranges this version is in (the ranges only it can support)
var ranges = getCriticalRanges(target.name, curVersion);
// if this version satisfies all of the ranges, then we can replace with this version
for (var j = 0; j < ranges.length; j++) {
if (!semver.match(ranges[j], lookup.version))
continue check;
}
// if the version is not equal to our target, deprecate the old version
if (lookup.version != curVersion) {
var oldName = lookup.name + '@' + curVersion;
if (ranges.length) {
useExisting = true;
ui.log('info', (nodeSemver.gt(lookup.version, curVersion) ? 'Upgrading' : 'Downgrading') + ' `' + oldName + '` to `' + lookup.version + '`');
}
else {
// wasn't critical anyway - just remove
deprecated.push(oldName);
}
// remove all traces, but leave the package in the file system for cache value
delete config.depMap[oldName];
versionList.splice(i--, 1);
}
}
检查:for(var i=0;i
我以前从未在JavaScript中见过这种情况。我在这里找到的:
那是什么?这是一个供继续
跳转到的问题
示例(来自链接页面):
loop1:
for(i=0;i<3;i++){//第一个for语句标记为“loop1”
循环2:
for(j=0;j<3;j++){//第二个for语句标记为“loop2”
如果(i==1&&j==1){
继续循环1;
}
console.log(“i=“+i+”,j=“+j”);
}
}
但请注意同一页上的警告:
避免使用标签
标签在JavaScript中不太常用,因为它们使
更难阅读和理解的程序
这是一个
loop1:
for (i = 0; i < 3; i++) { //The first for statement is labeled "loop1"
loop2:
for (j = 0; j < 3; j++) { //The second for statement is labeled "loop2"
if (i == 1 && j == 1) {
continue loop1;
}
console.log("i = " + i + ", j = " + j);
}
}