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

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.