I have a function called myFunction that can be called once from an
onclick() or 100 times from a function called loopFunction which
contains a for(var i=0;i<100;i++) loop.
Within myFunction is a setTimeout() function like this:
setTimeout(func tion(){shuffleD oor()},1500);
Now, when I call myFunction from onclick() it waits 1.5 seconds and
then calls the shuffleDoor function, just as I imagine it should.
However when I call the function from loopFunction it is called 100
times but there is no 1.5 second delay between calls.
Why is this?
Thanks in advance.
onclick() or 100 times from a function called loopFunction which
contains a for(var i=0;i<100;i++) loop.
Within myFunction is a setTimeout() function like this:
setTimeout(func tion(){shuffleD oor()},1500);
Now, when I call myFunction from onclick() it waits 1.5 seconds and
then calls the shuffleDoor function, just as I imagine it should.
However when I call the function from loopFunction it is called 100
times but there is no 1.5 second delay between calls.
Why is this?
Thanks in advance.
Comment