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

Brian Pelowski
Brian Pelowski
7,202 Points

Methods Part 3 - 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".

I entered the following code: ".concat([second],"dog")"

  var first =  ["The", "quick", "brown", "fox", "jumps"]

  var second =  ["over", "the", "lazy"];

  var saying = first.concat([second],"dog"); 

  var shortSaying = saying;

  var sayingString = saying;

It indicates that I generated the correct code, but apparently the syntax I used was not generated from the syntax that was wanted.

Bummer! Was expecting a 'saying' array of 'The,quick,brown,fox,jumps,over,the,lazy,dog' but got 'The,quick,brown,fox,jumps,over,the,lazy,dog'.

3 Answers

" Was expecting a 'saying' array of 'The,quick,brown,fox,jumps,over,the,lazy,dog' but got 'The,quick,brown,fox,jumps,over,the,lazy,dog'."

Those are the same. Try without [] around second

var saying = first.concat(second,"dog"); 
Brian Pelowski
Brian Pelowski
7,202 Points

Hmmmm, I thought I had tried it that way.

But thank you-

Jason Mc Dermott
Jason Mc Dermott
11,496 Points

thanks for the help but why aren't [] used for second, if its an array within an array isn't it needed?