From c9e4739120e1fd4c80a778cb8baa59dc08644765 Mon Sep 17 00:00:00 2001 From: Vedant Date: Tue, 16 Jun 2026 22:11:01 +0530 Subject: [PATCH] fix: convert dataset values to numbers in async typer --- exercises/73 - Async Typer/scripts-FINISHED.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/exercises/73 - Async Typer/scripts-FINISHED.js b/exercises/73 - Async Typer/scripts-FINISHED.js index 426d5bf45..3c16de033 100644 --- a/exercises/73 - Async Typer/scripts-FINISHED.js +++ b/exercises/73 - Async Typer/scripts-FINISHED.js @@ -6,25 +6,14 @@ function getRandomBetween(min = 20, max = 150, randomNumber = Math.random()) { return Math.floor(randomNumber * (max - min) + min); } -// async for of loop -// async function draw(el) { -// const text = el.textContent; -// let soFar = ''; -// for (const letter of text) { -// soFar += letter; -// el.textContent = soFar; -// // wait for some amount of time -// const { typeMin, typeMax } = el.dataset; -// const amountOfTimeToWait = getRandomBetween(typeMin, typeMax); -// await wait(amountOfTimeToWait); -// } -// } + // recursion function draw(el) { let index = 1; const text = el.textContent; - const { typeMin, typeMax } = el.dataset; + const typeMin = parseInt(el.dataset.typeMin, 10); + const typeMax = parseInt(el.dataset.typeMax, 10); async function drawLetter() { el.textContent = text.slice(0, index); index += 1;