Javascript Solution 95% fast
\nvar insert = function (intervals, newInterval) {\n    if (intervals.length === 0) {\n        return [ newInterval ];\n    }\n\n    const result = [];\n    let
```\nvar insert = function (intervals, newInterval) {\n    if (intervals.length === 0) {\n        return [ newInterval ];\n    }\n\n    const result = [];\n    let flag = 0;\n    let i;\n\n    for (i = 0; i < intervals.length; i++) {\n        const interval = intervals[i];\n        if (newInterval[0] > interval[1]){\n            result.push(interval);\n        } else if (newInterval[1] < interval[0]){\n            result.push(newInterval);\n            flag = 1;\n            break;\n        } else {\n            newInterval[0] = Math.min(newInterval[0], interval[0]);\n            newInterval[1] = Math.max(newInterval[1], interval[1]);\n        }\n    }\n\n    if (flag === 0) {\n        result.push(newInterval);\n        return result;\n    } else {\n        return result.concat(intervals.splice(i));\n    }\n};\n```
['JavaScript']