I have a string build form comma separated values I use split
to get each value and after that I want to show each value on a new line but what really happens is th
i have modified your function bit cleaner.since already stefan mentioned your mistake.
function splitDate(dates) {
if (dates != null)
{
var dates = dates.split(',');
var xxx = dates.length;
console.log(xxx);
for (var i=0; i
the above function you can do it in a single line:
if it's an array you can split into new line in following way:
var arr = ['apple','banana','mango'];
console.log(arr.join('\r\n'));
if it's a string:
var str = "apple,banana,mango";
console.log(str.split(',').join("\r\n"));