Nested setTimeout alternative?

前端 未结 6 1583
逝去的感伤
逝去的感伤 2020-12-10 04:22

I need to execute 3 functions in a 1 sec delay.

for simplicity those functions are :

console.log(\'1\');
console.log(\'2\');
console.log(\'3\');
         


        
6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 04:47

    setTimeout(function(){console.log('1')}, 1000);
    setTimeout(function(){console.log('2')}, 2000);
    setTimeout(function(){console.log('3')}, 3000);
    

提交回复
热议问题