Sometimes, we want to join a JavaScript string array into a string without commas.
In this article, we’ll look at how to join a JavaScript string array into a string without commas.
How to join a JavaScript string array into a string without commas?
To join a JavaScript string array into a string without commas, we can call the array join method with an empty string.
For instance, we write:
const s = ['foo', 'bar', 'baz'].join('')
console.log(s)
to call join on the array with an empty string.
As a result, s is 'foobarbaz'.
Conclusion
To join a JavaScript string array into a string without commas, we can call the array join method with an empty string.