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

Methods part 1 Task 3

I can't get past this question. It's asking me "On about line 20, add the 'firstWord' variable to the beginning of the array 'saying'."

My code below:

<script>
  var spareWords = ["The","chimney","sweep's","dog"];
  var saying = ["quick", "brown", "fox", "jumps", "over", "the", "lazy"];
  var firstWord = spareWords.shift();
  var lastWord = spareWords.pop();
  saying .unshift(firstWord);
  saying .unshift(lastWord);
</script>

Any help is appreciated.

saying .unshift(firstWord);

I got rid of the space you had between "saying" and ".unshift(firstWord);" . . . and it passed.

2 Answers

Its because under it you have this line saying.unshift(lastWord);. just comment it out like this //saying .unshift(lastWord); and it should pass.

Thanks! It was conflicting with the previous task. It worked after commenting it out.

saying.unshift(firstWord); You had a space there.

It's still giving me an error even after I closed the space. It returns: Bummer! There's something wrong with your 'saying' array.