在 javascript 中,我需要执行以下操作,用伪代码编写:
REPEAT EVERY 5 SECONDS
print 'One'
wait 2.5 seconds
print 'Two'
wait 2.5 seconds
我怎样才能做到这一点?我的(笨拙?)尝试如下:
a = setInterval(function() {
setTimeout(function(){print 'one'},0);
setTimeout(function(){print 'two'},2500);
},5000);
改进?