This is a continuation of another code snippet I found on here. Here's the idea:
I have an array of random strings, and I want this:
function updatePageTitle(text) {
document.title = text;
setTimeout(function () {
updatePageTitle(text.substr(1) + text.substr(0, 1));
}, 150);
}
to output something like this: (original text string) + new string + new string + new string (into infinity)
and have the new strings be randomized with this code:
var titles = ["string one", "string 2", "string 3"];
var title = titles[Math.floor(Math.random() * titles.length)];
newString = title
is there a way to do this? like can I make it do the function here every time the current string it is reading is finished?