'How to split a string into individual elements in javascript [closed]

I have a need to split a string in javascript to individual components. Let me go through the example of the requirement I'm having.

This is the string I'm having:

"[InsertDelta, position: 63, lines: [return {]]"

I need to split the above string into three components as below:

InsertDela
position: 63
lines: [return {]

Is there any way to separate the strings like this in javascript?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source