Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Review Array Methods, Iterating and Two-Dimensional Arrays

Combining arrays into a single string.

I don't remember the function name that allows me to answer the below question correctly. What is it? Also, please tell me where I can find a list of javascript functions I can refer to in the future. I already looked through MDN but I couldn't find it.

Finish the code by adding the array method that combines all of the items in an array into a single string.

var students = ["Sally", "Joan", "Raphael", "Sam"]; var message = "Hello " + students.?(", ");

3 Answers

Steven Parker
Steven Parker
229,732 Points

The join() method joins all elements of an array (or an array-like object) into a string and returns this string.

You will find a list of array methods on the left side of the MDN Array page. They are all links, so click on any method name to go to the page for that method. Also you can just hover the cursor over a method to get a description tooltip.

Thanks