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 trialPolo Moreno
11,782 Pointsi don't understand this question
On about line 20, add the 'firstWord' variable to the beginning of the array 'saying'.
my answer is this saying.unshift("firstword");
but say this You're missing the 'unshift' method and the 'firstWord' variable.
i create the variable but the system say repeat tag 1 what is the problem ?
<!DOCTYPE html>
<html lang="en">
<head>
<title> JavaScript Foundations: Arrays</title>
<style>
html {
background: #FAFAFA;
font-family: sans-serif;
}
</style>
</head>
<body>
<h1>JavaScript Foundations</h1>
<h2>Arrays: Methods Part 1</h2>
<script>
var spareWords = ["The","chimney","sweep's","dog"];
var saying = ["quick", "brown", "fox", "jumps", "over", "the", "lazy"];
var firstWord = spareWords;
var lastWord = spareWords;
saying;
saying;
</script>
</body>
</html>
1 Answer
David Clausen
11,403 PointsYou seem to be doing it right, but variables are caps-sensitive. Your answer is:
saying.unshift(firstword);
which is not the same as
saying.unshift(firstWord);
firstWord as a capital W in Word, your is a lower case w in firstword.
firstWord vs firstword two different variables, make sense?
Also you casted it as a string which is not a varible but a string called 'firstWord' vs firstWord
Polo Moreno
11,782 PointsPolo Moreno
11,782 Pointsthis is my first answer but the system say You're missing the 'unshift' method and the 'firstWord' variable.
David Clausen
11,403 PointsDavid Clausen
11,403 PointsYour going to have to paste your whole code. As from here that was your issue. Seeing as that doesn't fix it, I need to see code. Copy and paste what your working on in between
```javascript
//Copy Code in between here
```
Polo Moreno
11,782 PointsPolo Moreno
11,782 Pointsthis is my code
<!DOCTYPE html> <html lang="en"> <head> <title> JavaScript Foundations: Arrays</title> <style> html { background: #FAFAFA; font-family: sans-serif; } </style> </head> <body> <h1>JavaScript Foundations</h1> <h2>Arrays: Methods Part 1</h2> <script> var spareWords = ["The","chimney","sweep's","dog"]; var saying = ["quick", "brown", "fox", "jumps", "over", "the", "lazy"]; var firstWord = spareWords.shift(); var lastWord = spareWords.pop(); saying.unshift("firstWord"); saying; </script> </body> </html>
this is the question
On about line 20, add the 'firstWord' variable to the beginning of the array 'saying'.
and system say this
You're missing the 'unshift' method and the 'firstWord' variable.
David Clausen
11,403 PointsDavid Clausen
11,403 PointsI copied your answer and didn't even notice the other mistake. Silly me. I've edited my answer to include that.
You said earlier
So the first mistake was firstword capitalize, but I missed the second mistake. You have "" wrapped around the variable. That makes it a string variable that contains the word "firstWord". A variable is without quotes which is
firstWord contains the string "The"
"firstWord" contains the string "firstWord"
My bad for not catching that too.