javascript - setTimeout runs twice after the first iteration -
    (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 simon's game, , when computer shows sequence, animation twice (_bubies.clicked()). happens when sequence.length @ least 2, , animtes twice regardless how long sequence is.
 
 
  
Comments
Post a Comment