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

Shaun Russell
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Shaun Russell
Front End Web Development Techdegree Graduate 18,510 Points

I do not understand the question in JavaScript Methods Part 1 Code Challenge.

I thought what was being asked of me was to add a string to the beginning of the array called 'firstWord' and then turn around and take the first string of the array, which was the string I just added ('firstWord'), right back off. Can someone either rephrase the question or give me the answer so I can figure out what was really being asked.

1 Answer

geoffrey
geoffrey
28,736 Points

They just want you to put the first word of the spaceWords array (which is "The") inside the variable firstWord, using a method. Think about the method you could use to achieve this.

Here a "generic exemple", I don't give you the method:

      var spareWords = ["The","chimney","sweep's","dog"];

      var firstWord = spareWords.methodYouNeedtoFind();

      // once the method applied firstWord will have the string "The".

Jim shows how to use this method in the course :) If ever you are blocked, feel free to ask but that shoudln't be too difficult to solve, you'll find the answer :).