function roundNum(num, dec) {
                    return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
                }
Prints a hierarchy. Parameter 2 and 3 should not be passed by user code.
@param obj an object with a structure like: {title: 'root', children: [{title: 'ch1', children: []}, {title: 'ch2', children: []}]}