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

Practice const and let workshop

So in the video she uses the spread operator (which means nothing to me as I have never seen it before).

What's an alternative way to doing this?

The task is write the code for function addNewTeachers() found on line 35. This function should receive parameter newTeachers, defined on line 52, and add the new teachers to the treehouseTeachers variable.

function addNewTeachers(newTeachers) {
    // TODO: write a function that adds new teachers to the teachers array 

  teachers.push(...newTeachers);
}

2 Answers

Steven Parker
Steven Parker
231,007 Points

An alternative to using the spread operator would be to create a loop to iterate through the items of the array and to push them onto the new array one at a time.

And to facilitate specific and accurate answers, always provide a link to the course page you are working with.

Ok but I did put the title of the workshop and I thought if you posted from the course it did that automatically anyway?

Steven Parker
Steven Parker
231,007 Points

It should format and include your code, and provide a link button in the upper right if you start a question by using the "Get Help" button.