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 trialJames Padden
355 Pointshow do i add two value to an array by concatenation using the append method?
??
// Enter your code below
var arrayOfInts = [0,1,2,3,4,5]
arrayOfInts.append [0,1,2,3,4,5] + [6,7]
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHey James,
I feel you may be misinterpreting the instructions.
There are two parts to the second task, and each part is individual in itself. The first part wants you to use append()
to add a value and the second part wants you to use concatenation
to add another value, so the answer will be two lines of code like so:
arrayOfInts.append(6)
arrayOfInts += [8]
It may be a good idea to have a quick review of Adding Items to Arrays before moving on.
Keep Coding! :)
James Padden
355 Pointsi typed everything in like you said and it worked, but i dont understand why the bottom is 8 lol?
Jason Anders
Treehouse Moderator 145,860 PointsThe 8 is just the value I chose to add to the array. If I knew how to count, I would have used 7 Lol .
:)
So, it could have be anything really...
James Padden
355 PointsJames Padden
355 Pointsthank you