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 Loops, Arrays and Objects Tracking Multiple Items with Arrays Review Array Methods, Iterating and Two-Dimensional Arrays

Something is wrong

==

Say you have two arrays -- oldScores and newScores and you want to combine those two into a new array named allScores. Complete the code so that the new array first has the old scores listed followed by the new scores:

var allScores = .concat();

Tried "var allScores = newScores.concat( oldScores);" and "var allScores = oldScores.concat(newScores);"

all wrong....

3 Answers

Marileen Mennerich
Marileen Mennerich
1,161 Points

var allScores = oldScores.concat(newScores); worked for me, maybe you had a little typo somewhere?

no, Copy&paste it 3 times...

Marileen Mennerich's answer worked for me as well in the quiz.

Say you have two arrays -- oldScores and newScores and you want to combine those two into a new array named allScores. Complete the code so that the new array first has the old scores listed followed by the new scores:

Greg Phil
Greg Phil
1,149 Points

This is not working for me. This is copy and pasted directly from what I have on the screen. Can anyone see where I went wrong?

var allScores = oldScores.concat(newScores);

var allScores = oldScores.concat(newScores);

Khalid Yousif
Khalid Yousif
2,785 Points

var allScores = oldScores.concat(newScores);