RickBacci
10/13/2015 - 4:30 PM

countdown.js

function countdown(seconds, callback){
  var interval = setInterval(function () {
    if (seconds) {
      callback(seconds--);
    } else {
      clearInterval(interval);
    }
  }, 1000);
}

countdown(5, function (s) {
  console.log('wowowowowow', s);
});