I was wondering if I could use promises with my countdown timer. My code looks something like this:
function countdown(duration, callback) {
...
}
function sayHi() {
console.log('hi');
}
and I call it by doing something like
countdown(15, sayHi);
Is there a way I could do this instead?
countdown(15).then(sayHi);
Here is a JSFiddle of my current code.