for (var i=0; i<sequence.length; i++) {
allowclick=false;
function playTimeout(n) {
setTimeout(function() {
_bubis[n].clicked();
}, i*1000+750);
}
setTimeout(function(){allowclick=true},sequence.length*1000+750);
playTimeout(sequence[i]);
console.log(sequence);
}
problem: I'm doing a Simon's game, and when the computer shows the sequence, it does the animation twice (_bubies.clicked()). It only happens when sequence.length is at least 2, and animtes twice regardless how long the sequence is.