7c7 < function resolveAfter20Seconds() { --- > function resolveAfter2Seconds() { 15c15 < }, 20000); --- > }, 2000); 19c19 < function resolveAfter10Second() { --- > function resolveAfter1Second() { 27c27 < }, 10000); --- > }, 1000); 33d32 < setTimeout(() => { document.getElementById('twoslowonefast').style.opacity='1.0'; }, 1000); 36c35 < const slow = resolveAfter20Seconds(); --- > const slow = resolveAfter2Seconds(); 40c39 < const fast = resolveAfter10Second(); --- > const fast = resolveAfter1Second(); 44d42 < document.getElementById('twoslowonefast').style.opacity='0.3'; 49d46 < document.getElementById('twologslowthenfast').style.opacity='1.0'; 52,53c49,50 < const slow = resolveAfter20Seconds(); < const fast = resolveAfter10Second(); --- > const slow = resolveAfter2Seconds(); > const fast = resolveAfter1Second(); 61d57 < document.getElementById('twologslowthenfast').style.opacity='0.3'; 66d61 < document.getElementById('threelatertwologslowthenfast').style.opacity='1.0'; 70,71c65,66 < resolveAfter20Seconds(), < resolveAfter10Second(), --- > resolveAfter2Seconds(), > resolveAfter1Second(), 78d72 < document.getElementById('threelatertwologslowthenfast').style.opacity='0.3'; 83d76 < document.getElementById('onelogfastoneslow').style.opacity='1.0'; 87,88c80,81 < (async () => consolelog(await resolveAfter20Seconds()))(), < (async () => consolelog(await resolveAfter10Second()))(), --- > (async () => consolelog(await resolveAfter2Seconds()))(), > (async () => consolelog(await resolveAfter1Second()))(), 91d83 < document.getElementById('onelogfastoneslow').style.opacity='0.3'; 96c88 < setTimeout(() => { document.getElementById('status').innerHTML+='
' + aminterested + ' started call of consolelog("' + blb + '") at ' + (new Date()) + ' ... '; }, 1000); --- > document.getElementById('status').innerHTML+='
' + aminterested + ' started call of consolelog("' + blb + '") at ' + (new Date()) + ' ... '; 100c92 < setTimeout(() => { document.getElementById('status').innerHTML+='
' + aminterested + ' finished call of consolelog("' + blb + '") at ' + (new Date()) + ' ... '; }, 1000); --- > document.getElementById('status').innerHTML+='
' + aminterested + ' finished call of consolelog("' + blb + '") at ' + (new Date()) + ' ... '; 117,125d108 <

Lazy Evaluations and async Demonstration

<

RJM Programming - October, 2023 ... thanks to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function

<

The h3 elements below fade as they are achieved ...

<

After 20 seconds, logs "slow", then after 10 more second, "fast"

<

After 20 seconds, logs "slow" and then "fast"

<

Three seconds later, after 20 seconds, logs "slow" and then "fast"

<

After 10 second, logs "fast", then after 10 more second, "slow"

<
<