We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/* * description : 红绿灯算法 */ // 有黄绿红,他们各自亮灯的持续时间是 1s,2s,3s 如此反复。 // 还有暂停开始之类的功能: function timePromise(time) { return new Promise((resolve, reject) => { setTimeout(resolve, time) }) } async function setColor(i, color) { console.log('设置颜色', color) await timePromise(i) } async function run() { // 这里用了while循环 递归也可以 while (true) { await setColor(3000, 'red') await setColor(2000, 'green') await setColor(1000, 'yellow') } } run()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: