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 trial

JavaScript JavaScript Foundations Arrays Methods: Part 1

Can not get unshift to work on quiz for methods 1 in Arrays stage 4 but the code works in my workspace

Code does not work in exam but works in my workspace spareWords.unshift("firstWord"); console.log(spareWords.toString()); var value = spareWords.shift(); console.log(spareWords.toString());

2 Answers

Hi Jason, Thank you for your reply. I finally figured it out last night and yes, it was task 3 and your explanation below is what I came up with also. I guess I was over thinking the question. Thanks again

Hi Allen,

I'm not sure which task you're on. Since I see unshift in the code I'll assume task 3. You have some extra code there not called for in the challenge.

In your code you're adding on to the spareWords array the string "firstWord".

You're supposed to add on to the beginning of the saying array the value of the variable firstWord not the string.

saying.unshift(firstWord);

Let me know if you were on a different task.