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

jonathan addy
jonathan addy
15,534 Points

Methods Part 1: Elements task 3 -On about line 20, add the 'firstWord' variable to the beginning of the array 'saying'.

On Methods Part 1: Elements task 3 the question asks "On about line 20, add the 'firstWord' variable to the beginning of the array 'saying'."

I am answering

saying.unshift("firstWord"); but cant seem to get past this where am I going wrong?

Andrew Shook
Andrew Shook
31,709 Points

Which lesson is this from? I can't seem to find it for reference.

3 Answers

Zoe Peng
Zoe Peng
10,809 Points

You should take off the quotation

saying.unshift(firstWord);
Andrew Shook
Andrew Shook
31,709 Points

Never mind, the problem is a syntax error. When you pass a variable, like firstWord, into a method as an argument you don't need to put it in quotations. Right now you are putting the word "firstWord" into the array as the first word instead of the value of the firstWord variable.

christopher couret
christopher couret
10,297 Points

great! I have the same answer

saying.unshift(firstWord);