There is a var i, change value from 0 to 9 constantly and randomly; trigger function A only when i==1 for 200 milliseconds. Wondering if there are any functions to work this out?
There is a var i , change value from 0 to 9 constantly and
Share
You would need to use
setTimeout[MDN] to monitor the value of the variable. I would set the interval at 200ms and set a flag when the variable is the target value. If the variable is still the target value on the next interval, execute your function.