From 5a6645745d0a3ff12d740f69fa5f7997fc48f314 Mon Sep 17 00:00:00 2001 From: Edward L Platt Date: Mon, 13 Feb 2023 09:11:43 -0500 Subject: [PATCH] Adds console log output for both examples. --- index.html | 2 +- script.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) 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); } };