I would like to know if it is possible to run multiple instances of the same function in Javascript.
I have a function:
function timer(element){
setInterval(function(){
//do something on element being passed
}, time);
}
The second element which is to be passed and the other elements which follow are never being taken into account as the previous setInterval() would still be running (that is the setInterval() of the first element). Also, time is always changing with each different element that is being passed. Is there a solution to work around this in Javascript please?
Thank you
Aucun commentaire:
Enregistrer un commentaire