Hey guys am a learner and I have a string which I want to convert to an array
var myString = 'one,two\nthree,four\nfive\nsix,seven'
I want to convert this to an array of array like below
var newArray = [['one','two'],['three','four'],['five'],['six','seven']]
In my newArray I want to convert the line break in myString to an array and also split the words and put them as individual elements in an array
I hope I see help
You can split on a newline, and then use map to split all the parts on a comma.