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 2 - Code Challenge

Just thought this is the best error I have saw on Treehouse:

alt text

Ha.

2 Answers

You missed to declare the array with the name "saying" at the beginning and then include the data inside the array.

Thanks Rodrigo, I was actually not confused on how to solve it. I was just pointing out a bug....

                var first =  ["The", "quick", "brown", "fox", "jumps"]
                var second =  ["over", "the", "lazy"];
                var saying = first.concat(["over","the","lazy","dog"]);


                 var first =  ["The", "quick", "brown", "fox", "jumps"]
                 var second =  ["over", "the", "lazy"];
                 var saying = first.concat(second, "dog");

Either one of the above work, but the 2nd method requires less code. Also, it is probably what they're actually looking for.....

Hey guys, I just posted a discussion on the same topic... I don't realized yet the solution for the second part of the second challenge ... I could use some light here, cause I'm stuck.

The challenge tip was to use a 'length' property inside the function, to organize the array beginning by the shortest string... I've tried that, the result was the array beginning by the shortest string, but the challenge was not satisfied by just that.