Thanks for answering.
Sorry for only including this part of the code, but it is long and only this part presents an error. I'm including a printscreen to make it easier to read.
Regarding the error: this part of the code should display a total (totalCharacters) of digits (letters or numbers) one by one with a pause of 1.5 seconds between them and as it shows each digit, it then shows an asterisk in its place.
Example with 3 digits:
Step 1: 7
Step 2: *
Step 3: * 4
Step 4: * *
Step 5: * * 1
Step 6: * * *
The error that occurs is that the first digit (7 in the example) is repeated 2 times, generating 4 digits in the result, instead of 3
Example of a 3-digit error:
Step 1: 7
Step 3: *
Step 4: 7
Step 5: *
Step 6: * 4
Step 7: * *
Step 8: * * 1
Step 9: * * *
I replaced the timer for every second event to see if the error could be in the behavior, but it didn't solve it. The strangest thing is that this problem only appears in mobile device browsers. In the 3 desktop browsers (edge/chrome/firefox) this system works perfectly