user3559631
user3559631

Reputation: 53

setTimeout with a local variable?

function doAnimation(element, stuff){           
    setTimeout(animate(element, stuff), 1000);              
    }

function animate(element, stuff) {
}

Is there a simple solution to my problem? I have looked all over the place but cannot find what I am looking for.

Upvotes: 0

Views: 475

Answers (1)

Oleksandr T.
Oleksandr T.

Reputation: 77502

Try this,

function doAnimation(element, stuff){           
  setTimeout(function () { animate(element, stuff) }, 1000);              
}

function animate(element, stuff) {
}

Upvotes: 3

Related Questions