I'm reading about Web Workers http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#a-background-number-crunching-worker.
There is a code example with a word "search". What does it mean? Is it a new command?
var n = 1;
search: while (true) {
n += 1;
for (var i = 2; i <= Math.sqrt(n); i += 1)
if (n % i == 0)
continue search;
// found a prime!
postMessage(n);
}
This is labelled continue. The while
loop has search:
label, and continue
will continue the while loop. Without the label it would continue the for
loop.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With