0

how to set duration for a js function?

in js we can set time delay (after event ) for a function using setInterval setTimeout ,that repeat fxn after this much time, but how can we set the duration for a fxn i.e, do this fxn in given time. let say i have a button to change colour of a divi can set fxn delay but how can i code to change the colour in 3 sec. using js.

7th Jul 2020, 7:16 AM
Divya Mohan
Divya Mohan - avatar
1 Answer
0
setTimeout(function(){ do something here }, 3000);
7th Jul 2020, 7:35 AM
JME