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 trialname564681351614
3,497 PointsQuiz question number 2
I get the first question correct but when I go to answer the 2nd question it tells me that the first question is now wrong. I'm not sure what I'm doing wrong.
<!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>
2 Answers
Erik McClintock
45,783 PointsEric,
The error message that the challenge gave you is misleading; the problem in your code is that you've got "var" before "myArray" on line 18, which would be you redeclaring it. Remove "var", and you're good to go!
Erik
Allen Brown
32,515 PointsEric, try removing the var from line 18. You have already created the variable in line 16, so no need to use var again.