请使用javascript创建一个函数test1。此函数接受一个参数seconds调用此函数可实现等待指定秒数。请注意请使用setInterval完成这道题目。function test1seconds 请补全此处
function test1(seconds){ var count = seconds; var intervalId = setInterval(function(){ console.log(count); count--; if(count < 0){ clearInterval(intervalId); } }, 1000); }
// 例如:等待3秒后输出"Hello World!" test1(3); setTimeout(function(){ console.log("Hello World!"); }, 3000);
原文地址: https://www.cveoy.top/t/topic/eByP 著作权归作者所有。请勿转载和采集!