Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
216,083 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