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


Arvid Keskitalo
Arvid Keskitalo
23,406 Points

.unshift and .shift

"On line 18, use a method on the 'spareWords' to set 'firstWord' to be first word of the 'spareWords' array whilst simultaneously removing it from the beginning of the array" I have tried several times, can't solve this, need help

2 Answers

var firstWord = spareWords.shift();

shift() removes and returns the first element in an array. pop() removes and returns the last element.

Hope that helps. :)

Arvid Keskitalo
Arvid Keskitalo
23,406 Points

Hi, there! Well, I know the basics, but I can't get it to work in the challenge

It works perfect to me so it must work for you too. Try to reopen the browser and refresh the page with ctrl + F5 to clear the cached items.

Sometimes the challenges get buggy and you have to refresh a couple of times.