Reputation: 145
I have this code in JS:
var array = ['one', 'two'];
And each time I want to display the array, it is displayed with like this:
one,two
Now my question is, is there any way to remove that nasty comma?
Upvotes: 3
Views: 10419
Reputation: 6736
You could use the replace method of the string object:
array.toString().replace(',',' ')
Upvotes: 1
Reputation: 5822
To display them next to each other, you can use join. array.join(' ');
Upvotes: 14