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 trialDaniel Walsh
309 PointsWe need to append a few more items to our todo array. Append the following strings: "Debug App", "Fix Bugs".
Anyone know where I am going wrong with this? I thought they wanted me to enter in the todo.append tag but now I am not sure.
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App", "Fix Bugs")
1 Answer
Jhoan Arango
14,575 PointsHello Daniel:
There are 2 ways you can append or add an item into your array.
First : “You can add a new item to the end of an array by calling the array’s append method”
This only allows you to add ONE item at a time
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App")
todo.append("Fix Bugs")
Second : “Alternatively, append an array of one or more compatible items with the addition assignment operator (+=):”
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo += ["Debug App","Fix Bugs"]
both of these codes work for your challenge.
Daniel Walsh
309 PointsDaniel Walsh
309 PointsThanks man! That helped a lot!