Reputation: 17053
How would you go about putting an array into a textarea, each value on its own line? I thought about converting the array to a string, and the commas into new lines, but what if the value of an array item has a comma?
Upvotes: 0
Views: 1697
Reputation: 32888
Try with join
text = array.join("");
document.write(text); // or what ever you would do with text
Upvotes: 1
Reputation: 25014
If you have a comma delimited array that contains values with unescaped commas, you have an insurmountable problem. You need to convert the array into a string with some other sort of delimiter, preferably the linebreaks you want them to be in the end.
Upvotes: 0