Simple & Concise JS solution w/ comments
use ES6 destructuring assignment to make code much more concise and readable.\n\n\n// O(n), O(n)\nvar insert = function (intervals, newInterval) {\n  let [start
use ES6 destructuring assignment to make code much more concise and readable.\n\n```\n// O(n), O(n)\nvar insert = function (intervals, newInterval) {\n  let [start, end] = newInterval;\n  let left = [];\n  let right = [];\n  \n  for (const interval of intervals) {\n    const [first, last] = interval;\n\t\n\t// current interval is smaller than newInterval\n    if (last < start) left.push(interval);\n\t\n\t// current interval is larger than newInterval\n    else if (first > end) right.push(interval);\n\t\n\t// there is a overlap\n    else {\n      start = Math.min(start, first);\n      end = Math.max(end, last);\n    }\n  }\n  \n  return [...left, [start, end], ...right]; \n};\n```
['JavaScript']