Skip to content

Instantly share code, notes, and snippets.

@alecperkins
Forked from bnb/names.js
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save alecperkins/d26741ed5fb7eb07e42c to your computer and use it in GitHub Desktop.

Select an option

Save alecperkins/d26741ed5fb7eb07e42c to your computer and use it in GitHub Desktop.
Use Array::shift and Array::push to cycle through the names indefinitely.
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