有没有办法在随机秒后将数字增加 1。例如,基值是 10。所以它会在随机秒后变化 1(即随机 1/2/3/4/5 秒)。
我试过这样:
var startVal = 10;
setInterval(function(){
var theVal = startVal + 1;
startVal = theVal;
}, Math.round(Math.random() * (6000 - 2000)) + 2000);
数量在增加,但时间不是随机的。请帮忙。
跃然一笑
猛跑小猪
翻翻过去那场雪
随时随地看视频慕课网APP
相关分类