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

.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