How to convert array into string without comma and separated by space in javascript without concatenation?

When you call join without any argument being passed, ,(comma) is taken as default and toString internally calls join without any argument being passed.

So, pass your own separator.

var str = array.join(' '); //'apple tree'
// separator ---------^

MDN on Array.join

Leave a Comment