Owennn Owennn - 1 year ago 50
Javascript Question

How to join array of strings in Javascript

I want to join an array of

result = ["July"," ","1st"]
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 Source

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

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