Callback of setTimeout function when performing synchronous actions
I'd make the counter function return a promise. If you understand promises, I think this example will be enough. If not, please ask and I'll clarify.

function counter(count) {
    var deferred = Promise.defer();

    var countDownFrom = count;
    var timer = setInterval(function() { handleTimer(countDownFrom); }, 1000);

    function handleTimer(count) {
        if (count === 0) {
            clearInterval(timer);
            deferred.resolve();
        } else {
            console.log(count);
            countDownFrom--;
        }
    }

    return deferred.promise;
}

Promise.resolve()
    .then(function() {
        console.log('start');
        return counter(3);
    })
    .then(function() {
        console.log('ready');
    });