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

How do I complete part 1 of this challenge?

http://teamtreehouse.com/library/javascript-foundations/arrays/methods-part-3-2

Challenge question says: ''Challenge Task 1 of 3–On line 18, set the variable 'saying' to the concatenation of the 'first' and 'second' arrays with the word "dog"."

<script>
      var first =  ["The", "quick", "brown", "fox", "jumps"]
      var second =  ["over", "the", "lazy"];
      var saying = first; 
      var shortSaying = saying;
      var sayingString = saying;
    </script>

So I changed line 18 to: var saying = first.join(' ') + ' ' + second.join(' ') + ' dog';

This returns the correct phrase "The quick brown fox jumps over the lazy dog".

Is this a bug? b/c all I get are error messages, such as: "Bummer! There was an error with your code: TypeError: 'undefined' is not a function (evaluating 'window.saying.join(" ")')"

(window does not even appear anywhere in the code...)

(PS. Does anyone know how to add an image here from my desktop?)

2 Answers

Hi Beth,

Don't know if you are still working on this You don't need to use the first.join operator. Declare the variable as a concatenation of the two arrays, which are already labeled, and concatenate them with dog. Hope this helps.

I don't think I explained this well. Sorry, I'm just a student too. What I meant was when you join your arrays , all the strings were separated and you just need to use a single join. Ugh, I need to practice explaining versus just writing the answer. sooo i'm trying!