01
Sep
Learn how to pass parameter to javascript setTimeout function
Think if you want to pass parameters to setTimeout function of javascript. Then, there are 2 common ways to do it.
Following one is the most preferred way. Here, yourfunction() is the function which you want to call and the para1, para2, paraN are the parameters which you want to call.
setTimeout(function(){ yourfunction(para1, para2, paraN); } , 2000);
The second way as follows,
setTimeout(yourfunction, 2000, para1, para2, paraN);