The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

## Combine Values of an Array into a String with Join

#### Combine Values of an Array into a String with Join

4:42
The join() method joins all elements of an array into a string. In this lesson we first look at why `join` is often a better option than regular string concatenation. Then we move onto an example which shows a simple way of storing lines of text in an array and outputting them with a new line separator and we finish by looking at ways to chain multiple array methods together.
Watch this lesson now

The join() method joins all elements of an array into a string. In this lesson we first look at why `join` is often a better option than regular string concatenation. Then we move onto an example which shows a simple way of storing lines of text in an array and outputting them with a new line separator and we finish by looking at ways to chain multiple array methods together.

Wendy

How great would it be if you could go back and have learned JavaScript by watching your way through a series of 4-minute Shane Osbourne in-depth videos? Starting at the start and ending at the end.

Shane

Hi Wendy - I'm extremely happy to hear that you're enjoying these videos :)

Jason

I am a little confused with the .map syntax. I understand what it is doing, but have never seen that syntax before.

.map(x => x.charAt(0).toUpperCase + x.slice(1))

what does the "x =>" do? Is that like saying x is greater than or equal to (x >=)?

Joel

I am a little confused with the .map syntax. I understand what it is doing, but have never seen that syntax before.

.map(x => x.charAt(0).toUpperCase + x.slice(1))

what does the "x =>" do? Is that like saying x is greater than or equal to (x >=)?

This is the same as:

``````.map(function(x) {
return x.charAt(0).toUpperCase + x.slice(1)
});
``````

`=>` is the ECMAScript 6 arrow function operator. https://egghead.io/lessons/arrow-function