How to wait for function to stop before calling it again
Advertisements I have had trouble trying to get my function to finish before calling it again. This is my code now: function TypeAnimation(str, time) { var text = document.getElementById(‘loading’); for (let i = 0; i < str.length; i++) { let k = i; setTimeout(function(){ text.innerHTML += str.charAt(i); }, time * (k + 1)); } }… Read More How to wait for function to stop before calling it again