Advertisement
Mirzapulatov

Untitled

Nov 21st, 2022
733
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sleep(ms) {
  2.     return new Promise(resolve => setTimeout(resolve, ms));
  3. }
  4. async function typing(id, text, deley = 80) {
  5.     for(let index = 0;index < text.length;index++){
  6.        document.getElementById(id).append(text[index])
  7.        await sleep(deley)
  8.      }
  9. }
  10. typing("string", "Hello, World. My name is Debugger!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement