输出

The highest prime number discovered so far is:

示例代码

Worker demo: One-core computation, the main document spawns a worker to compute prime numbers, and progressively displays the most recently found prime number.

HTML:

  
  <p>The highest prime number discovered so far is: <output id="result"></output></p>
  <script>
    var worker = new Worker('worker.js');
    worker.onmessage = function (event) {
    document.getElementById('result').textContent = event.data;
  };
  </script>