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

.unshift firstWord

On about line 20, add the 'firstWord' variable to the beginning of the array 'saying'.

so what i think its saying is to do the unshift method but ive tried everything else so somethin is wrong with the syntax and i cant figure it out. he didnt show anything about putting a var inside a var thats inside a var already. something is wrong . help please

<!DOCTYPE html>
<html lang="en">
    <title> JavaScript Foundations: Arrays</title>
      html {
        background: #FAFAFA;
        font-family: sans-serif;
    <h1>JavaScript Foundations</h1>
    <h2>Arrays: Methods Part 1</h2>
      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 = firstWord.unshift();

2 Answers

You're thinking of the right method, but you're using it incorrectly.

You call the method on saying and pass the firstWord variable as a parameter, like this:


ooooooohhhhhh that makes so much more sense lol thank you