JavaScript function for logging the members of an object (with horizontal alignment)
Simplification with for/in loops

Your loop through Object.keys() in the function you have for the max variable is reinventing JavaScript's for/in loop which loops over and objects keys. Here's how you could simplifying that code:

for(var key in obj) {
    if(!obj.hasOwnProperty(key)) {
        continue;
    }

    if(key.length &gt; ret) {
        ret = key.length;
    }
}




Unnecessary recursion

Your getSpacer function is using recursion when it really does not need to be; the function would be a lot simpler and a lot faster if you used a neat JavaScript trick for repeating characters:

function getSpacer(len) {
    return Array(len + 1).join(" ");
}


Now, there's no need for recursion - that means there is less interaction with the stack - and, rather than switching to a loop, this nice solution can be used.