Thunderstorm
user_1671475754
javascript
4 years ago
353 B
9
Indexable
function thunderstorm(stormEvents) {
if (stormEvents.length === 0) return;
current = stormEvents.shift();
if (current === "lightning") {
console.log("FLASH!")
setTimeout(console.log,400, 'BOOM!' );
} else {
// log first
console.log(current);
}
setTimeout(function() {thunderstorm(stormEvents)}, 200);
}Editor is loading...