I have an array and want to split two data that contain in one array element.
Here is the code :
const array = ["1 Boston 4 11", "2 Florida 6 14\n3 Texas 5 12", "4 California 7 13"];
array.map(x => {
return (
console.log(x.split(" "))
)
});
array[1] contain two data : 2 Florida 6 14 and 3 Texas 5 12. I need to split array[1] to two different arrays with each data.
Result i expect :
[
"1",
"Boston",
"4",
"11"
]
[
"2",
"Florida",
"6",
"14"
]
[
"3",
"Texas",
"5",
"12"
]
[
"4",
"California",
"7",
"13"
]
Anyone can please help me to solve that?