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 trialJason Hoffman
5,255 Pointsafter answering task one, it won't let me submit task two because task one is no longer valid.
I was told that when I submitted task one it was correct, but when I submit task two, it says that task one is no longer valid, and I am not sure why.
grocery_list = ["milk", "eggs", "bread"]
grocery_list.push "carrots"
grocery_list.unshift = "celery"
Steve Hunter
57,712 PointsHey, no problem! :-)
2 Answers
Kevin Korte
28,149 PointsTry using the unshift method without the equals, just like you did with the push method
Steve Hunter
57,712 PointsThat's not too clear but it is because you got the last line slightly wrong.
If you amend that to:
grocery_list.unshift("celery")
then that should work fine.
Steve.
Jason Hoffman
5,255 PointsJason Hoffman
5,255 PointsI see that my syntax was off when I was trying to push the new array item. Thanks for your help in responding!