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


pass a delimiter in to join.

['apple', 'tree'].join(' '); // 'apple tree'

Use the Array.join() method. Trim to remove any unnecessary whitespaces.

var newStr = array.join(' ').trim()