Self-destruction lever with a timer and alarm.
var detonator = function (count) { return function () { if (count > 0) { console.log(count + "..."); count--; setTimeout(detonator(count), 1000); } else { console.log("BOOM!"); } }; }; var bomb = detonator(3); bomb();