Javascript BFS iterative one queue
\nvar maxLevelSum = function(root) {\n    if (!root)\n        return 1;\n    \n    const queue = [root];\n    const levels = [];\n    \n    while (queue.length)
```\nvar maxLevelSum = function(root) {\n    if (!root)\n        return 1;\n    \n    const queue = [root];\n    const levels = [];\n    \n    while (queue.length) {\n        const level = [];\n        let size = queue.length;\n        \n        for (let i = 0; i < size; i++) {\n            const node = queue.shift();\n            level.push(node.val);\n            \n            if (node.left)\n                queue.push(node.left);\n            if (node.right)\n                queue.push(node.right);\n        }\n        \n        levels.push(level.reduce((acc, curr) => acc + curr));\n    }\n    \n    return levels.indexOf(Math.max(...levels)) + 1;\n};\n```
['JavaScript']