Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- }
- async function typing(id, text, deley = 80) {
- for(let index = 0;index < text.length;index++){
- document.getElementById(id).append(text[index])
- await sleep(deley)
- }
- }
- typing("string", "Hello, World. My name is Debugger!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement