FYI--- I read the duplicate to this question and got nowhere.
I Have a website up on fire base here and if you see there's a button div that reads "See what I can do" I want to to display that message one character at a time. I immediately thought of using a for loop and str.substr() as well as an interval. This is all my brain could muster
const msg = "See What I can do";
function displayMsg(msg) {
let newMsg = "";
for(let i = 0; i < msg.length + 1; i++) {
console.log(msg.substr(0, i));
}
}
setInterval(displayMsg(msg), 1000);
doesn't work because it just runs through the whole loop. How can I make it stop and wait 1s every iteration? Is there a more popular approach to this problem?