Here I am Taking a string data and converting it into array elements but it is getting an empty array at last of all array elements and I am not be able to remove them easily.Please help.
let string_Data = `01226,Grover Cleveland,Anna,Uganda,Crucial Ltd,Tested Mutual B.V,Calvin Coolidge,
77110,John F. Kennedy,hora,Bosnia Herzegovina,Formal,Papal Corporation,Franklin Roosevelt,
29552,Lyndon B. Johnson,Margaret,Palau,Summaries Holdings Inc,Customize,Rutherford B. Hayes,`;
let making_Array = csv => {
var data = [];
for (let dataAry of csv.split('\n')) {
data.push(dataAry.split(','));
}
return data;
}
console.log(making_Array(string_Data));
Instead of manipulating arrays, you can prepare the string before being split.
FWIW the entire function can be streamlined, and enhanced like this: