function red() {console.log('red');}function green() {console.log('green');}function yellow() {console.log('yellow');}function lightPromise(func, delay) {return new Promise((resolve, reject) => {setTimeout(() => {func();resolve();}, delay);})}function light() {Promise.resolve().then(() => lightPromise(red, 3000)).then(() => lightPromise(green, 1000)).then(() => lightPromise(yellow, 2000)).then(light)}light();
