Javascript solution, if anyone is interested
var levelOrder = function(root) {\n        var result = [];\n        var level = 0;\n        traverse(root, level);\n        return result;\n    \n        funct
    var levelOrder = function(root) {\n        var result = [];\n        var level = 0;\n        traverse(root, level);\n        return result;\n    \n        function traverse(root, level) {\n            if (root === null) {\n                return;\n            }\n            else {\n                if (level >= result.length) {\n                     result[level] = [];\n                }\n                result[level].push(root.val);\n                traverse(root.left, level + 1);\n                traverse(root.right, level + 1);\n            }\n        }};
['JavaScript']