diff --git a/index.html b/index.html index 511d801..ce326b5 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ doUntil example -
Press one of the buttons below
+
Press one of the buttons below. Progress can be seen in the JavaScript console for both versions.

diff --git a/script.js b/script.js index a997ad5..c338e08 100644 --- a/script.js +++ b/script.js @@ -50,8 +50,9 @@ function findPrimesBlocking() { primes.push(n); } if (n % 10000 == 0) { - document.getElementById("display").textContent = - `Found ${primes.length} primes between 2 and ${n}`; + let status = `Found ${primes.length} primes between 2 and ${n}`; + document.getElementById("display").textContent = status; + console.log(status); } } document.getElementById("display").textContent = @@ -81,8 +82,9 @@ function findPrimesNonBlocking() { // Update DOM if we're about to yield if (yieldCondition()) { - document.getElementById("display").textContent = - `Found ${primes.length} primes between 2 and ${n}`; + let status = `Found ${primes.length} primes between 2 and ${n}`; + document.getElementById("display").textContent = status; + console.log(status); } };