Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Alessandra Vaughn
Alessandra Vaughn
13,915 Points

Code Challenge Issue: Trying to use unshift on an array and it doesn't like it.

I'm on the "Adding Items to an Array" of the "Tracking Multiple Items with Arrays" and I think there is a bug. Or I am missing something?

Instructions: Now, add 3 names to the beginning of the list using the other array method you learned in the last video

My code:

var guestList = ['Sandra', 'Omar', 'Magnus', 'Becky'];

guestList.push('Jacob', 'Lily');

guestList.unshift('Jake', 'Paula', 'Rick');

And the response from the program is this: Bummer! Looks like you're passing at least one empty string. Come on, give us 3 real names!

6 Answers

Treasure Porth
STAFF
Treasure Porth
Treehouse Teacher

Yeah, I think it's a bug. Your code worked fine for me in the command line, but Treehouse gave me the same error.

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Hi Alessandra Vaughn

Yes, this is a bug. I'm sorry for the frustration. I'ved fixed the problem and the code challenge should now work: https://teamtreehouse.com/library/javascript-loops-arrays-and-objects/tracking-multiple-items-with-arrays/adding-items-to-an-array

If you find another error like this in the course feel free to contact me directly via e-mail: dave@teamtreehouse.com.

cc Treasure Porth

Alessandra Vaughn
Alessandra Vaughn
13,915 Points

Thank you for fixing it so quickly. I really wanted my badge. :)

Kenoye Naku
Kenoye Naku
1,641 Points

Im also having this issue, my code isnt working it says task one is not being pushed.

Dave McFarland
Dave McFarland
Treehouse Teacher

Hello Kenoye Naku Can you show us the code you are typing into the code challenge?

Edward Smith
PLUS
Edward Smith
Courses Plus Student 4,230 Points

var guestList = ['Sandra', 'Omar', 'Magnus', 'Becky']; guestList.unshift('Bill', 'Ted', 'nilll');

Doesn't pass, but definitely should...

Ben Os
Ben Os
20,008 Points

Same bug here.