beginner-javascript
beginner-javascript copied to clipboard
Async Typer UI - getRandomBetween() not behaving as expected because it's being called with strings
trafficstars
https://github.com/wesbos/beginner-javascript/blob/ab2cb26365378b015e3ed3a630771baf3da261fa/exercises/73%20-%20Async%20Typer/scripts-FINISHED.js#L31
When passed to getRandomBetween() here, typeMin and typeMax are still strings taken directly from el.dataset. Not sure exactly how the function is treating these numeric strings under the hood, but it's not parsing them as ints:

Olá, é provável que na linha 27, onde:
const { typeMin, typeMax } = el.dataset;
O el.dataset, esteja passando os valores em string. tente adicionar nessa linha de código o parseInt:
const { typeMin, typeMax } = parseInt(el.dataset);
Talvez consiga converter esses valores em numbers.