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 Foundations Arrays Methods: Part 1

I am not understanding how to take the variable 'firstWord' and 'unshift' it to 'saying'?

I understand that in this Task, the 'shift' operator removes it from 'spareWords'.

2 Answers

Hi Jonathan, you can check out this past answer, it helps explain things.

Since saying is also an array you can use unshift() to add words to the front of the array. Just use the firstWord variable we created a few lines up to add the word into the saying array.

saying.unshift(firstWord);