setTimeout with parameters [ 1151 views ]
Goal: to find a compatible form of setTimeout calling with parameters
The general form is easy, but not working under ie…
setTimeout(function(p1, p2, p3){
console.log('parameters received: ' + p1 + ',' + p2 + ',' + p3);
},
1000,
param1, param2, param3);
The following form is ie compatible…
setTimeout(
(function(p1, p2, p3){
return function(){
console.log('parameters received: ' + p1 + ',' + p2 + ',' + p3);
}
}(param1, param2, param3)),
1000 );



