Owennn Owennn - 5 months ago 8
Javascript Question

How to join array of strings in Javascript

I want to join an array of

result = ["July"," ","1st"]
into
result = ["July 1st"].
I also want to have the comma removed.

I have tried result.join() and result.join(",") but it didn't work. In fact, nothing changes. Can anyone help me to solve this problem? Thanks.

Answer

You just need to join it and put into an array...:

result = [result.join('')];