Analog of PHP’s implode() Function in Javascript

There are many basic tasks that we can do automatically in familiar programming language, but when you migrate to another one you sometimes get stucked.

The very frequent task is to glue an array of strings into a string with some separator. You’ll use implode function in PHP world but unfortunately it doesn’t work in Javascript and you have to use another one:

var arr = ['Hello', 'World!'];
var gluedString = arr.join(' ');

Very easy, isn’t it?

Books to read

Leave a Reply

Your email address will not be published. Required fields are marked *