1let availableData = "Hello, Hi, Wassup";
2let desiredData = replaceCommaLine(availableData);
3function replaceCommaLine(data) {
4 //convert string to array and remove whitespace
5 let dataToArray = data.split(',').map(item => item.trim());
6 //convert array to string replacing comma with new line
7 return dataToArray.join("\n");
8}
9console.log(desiredData);