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 trialJoshua Gatonyi
679 PointsChallenge Task help
Hi, cant seem to pass task 2 of the challenge task.
whats wrong with my code?
var shoppingList = ["toothpaste", "bread", "eggs"] var cart = shoppingList.removeAtIndex[1]
thanks!!
2 Answers
Steve Hunter
57,712 PointsYou are removing the item at index [1]; that's not what the challenge is expecting.
You just need to assign the contents of that element to the variable named cart
. So:
var shoppingList = ["toothpaste", "bread", "eggs"]
var cart = shoppingList[1]
Hope that helps!
Steve.
Joshua Gatonyi
679 PointsThanks!
Steve Hunter
57,712 PointsNo problem! :-)