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 trialIra Salem
10,331 PointsTechnical Difficulties
The first part dealing with the "thirdElementInArray" variable was correct when I clicked on the check button. Afterwards when I type in the answer for the second challenge which states "On about line 18, set 31st element in 'myArray' to the world 'treehouse'" it says that the first challenge is no longer correct even though I didn't change anything from the first answer.
Sounds like some technical difficulties to me. Anybody else experience this or am I just flat out wrong and I did mess up 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: Getting and Setting</h2>
<script>
var myArray = ["sugar", "rush", "fix", "it", 3.14, 42];
var thirdElementInArray = myArray[2];
var myArray[30] = "treehouse";
</script>
</body>
</html>
5 Answers
Ira Salem
10,331 PointsI figured out the answer. It was
<p>myArray[30] = "treehouse";</p>
```
Hugo Paz
15,622 PointsHi Ira,
jeremie got the right idea, you are declaring the variable myArray again.
You should do myArray[30] = 'treehouse'
jeremie singler
4,569 Pointshello
It is because you are changing the value of myArray you need to set array to different name;
hope this will help
Nathan Smutz
9,492 PointsThe big problem I see is:
var myArray[30] = "treehouse";
myArray doesn't have a 30th item so that'll error. I imagine you meant to use a 3 there.
Sometimes it'll say something earlier broke when you introduce a bug.
Ira Salem
10,331 PointsWell the challenge is to make 'treehouse' the 31st element. I see what your saying but according to the video the only thing that should happen is every element in between that doesn't have anything assigned to it will be considered 'undefined' so it'll say 'undefined' repeatedly until it gets to the 31st element which should read 'treehouse' unless I'm not understanding something.
jeremie singler
4,569 Pointswhat you are lookin for isn't
treehouse = [30];
kind regards