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 trialChris Scott
7,673 PointsJavaScript Foundations - Arrays - Methods Part 3 - Code Challenge
var first = ["The", "quick", "brown", "fox", "jumps"];
var second = ["over", "the", "lazy"];
var saying = first.concat(second, "dog");
"foo.concat" isn't working as expected.
"var first.concat(second, "dog");" passes challenge 2 but when I try "saying" it returns this ["The", "jumps", "over", "the", "lazy", "dog"] in both Chrome Console and JSBin.
2 Answers
Ian Pilsner
5,174 PointsI used this method, and it gave me the same array, it is wrong? i know the challenge didn't pass me but it outputted the same array string.
var saying = first.concat(second + ",dog");
Chris Scott
7,673 PointsI believe you're supposed to pass just the two variables, instead of a concatenated one using the operator.
My solution passed the test just doesn't work in practice.