Javascript Solution
\n/**\n * @param {number[][]} intervals\n * @param {number[]} newInterval\n * @return {number[][]}\n */\nvar insert = function(intervals, newInterval) {\n    le
```\n/**\n * @param {number[][]} intervals\n * @param {number[]} newInterval\n * @return {number[][]}\n */\nvar insert = function(intervals, newInterval) {\n    let result = []\n    \n    for(let i = 0; i < intervals.length; i++){\n        //not overlapping with current interval\n        if(newInterval[1] < intervals[i][0]){\n            result.push(newInterval)\n            result.push(...intervals.slice(i))\n            return result\n        }else if(newInterval[0] > intervals[i][1]){\n            result.push(intervals[i])\n        }else{\n            //is overlapping with current interval\n            newInterval = [Math.min(newInterval[0], intervals[i][0]), Math.max(newInterval[1], intervals[i][1])]\n            //extend interval if needed\n        }\n    }\n    result.push(newInterval)\n    return result\n};\n```
[]