Skip to content

Instantly share code, notes, and snippets.

@bnb
Last active August 18, 2021 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bnb/100a12bc948bd1dd1362 to your computer and use it in GitHub Desktop.
Save bnb/100a12bc948bd1dd1362 to your computer and use it in GitHub Desktop.
Looking for a way to loop back to names[0]. The if() is the only way I can think of, but I'm not sure how to actually implement it.
var names = [
"&!",
"bnb",
"bang",
"bitnb",
"bitandbang",
"Tierney Coren"
]
for(i = 0; i < names.length; i++){
$('.title')
.typetype(
"I am " + names[i] ".",
{
e: 0.04, // error rate. (use e=0 for perfect typing)
t: 100, // interval between keypresses
})
.backspace(
names[i].length + 1,
{
t: 100 // interval between keypresses
});
if(names[i] === names.length) {
//What's the best way to reset the array to names[0]?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment