javascript - What does "check:" mean in front of a for loop? -
javascript - What does "check:" mean in front of a for loop? -
this question has reply here:
colon within javascript function while loop 4 answersi came across today:
check: (var = 0; < versionlist.length; i++) { var curversion = versionlist[i]; // find critical ranges version in (the ranges can support) var ranges = getcriticalranges(target.name, curversion); // if version satisfies of ranges, can replace version (var j = 0; j < ranges.length; j++) { if (!semver.match(ranges[j], lookup.version)) go on check; } // if version not equal our target, deprecate 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 + '` `' + lookup.version + '`'); } else { // wasn't critical anyway - remove deprecated.push(oldname); } // remove traces, leave bundle in file scheme cache value delete config.depmap[oldname]; versionlist.splice(i--, 1); } }
i've never seen in javascript before. found here: https://github.com/jspm/jspm-cli/blob/0.8.0-beta.2/lib/core.js#l328
what that?
it's label continue
jump to.
example (from linked page):
loop1: (i = 0; < 3; i++) { //the first statement labeled "loop1" loop2: (j = 0; j < 3; j++) { //the sec statement labeled "loop2" if (i == 1 && j == 1) { go on loop1; } console.log("i = " + + ", j = " + j); } }
but mind warning on same page:
avoid using labels
labels not commonly used in javascript since create programs harder read , understand.
javascript
Comments
Post a Comment