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 trialKain Prod
4,749 PointsJavascript Foundations Getting and Setting code challenge 2 of 2 not passing
For some reason the second question isn't passing. It says Task 1 is no longer passing. Here's my code:
The problem:
On about line 18, set the 31st element in 'myArray' to the word 'treehouse'.
my code:
var myArray = ["sugar", "rush", "fix", "it", 3.14, 42];
var thirdElementInArray = Murray [2];
var myArray[30] = "treehouse";
the challenge: http://teamtreehouse.com/library/getting-and-setting
I tried putting 30 instead of 31 and get the same thing,
Kain Prod
4,749 Pointshttp://teamtreehouse.com/library/getting-and-setting
var myArray = ["sugar", "rush", "fix", "it", 3.14, 42];
var thirdElementInArray = myArray[2];
var myArray[30] = "treehouse";
2 Answers
Jon Wood
9,884 PointsJust by eyeballing it, perhaps it's because you're basically initializing a new variable called "myArray" instead of using the one you initialized earlier.
Try it without the "var" on the third line...
myArray[30] = "treehouse";
Kain Prod
4,749 PointsThanks!
Harleigh Abel
4,547 PointsOhh man. I wish he had mentioned that in the lesson, would have saved me a lot of teeth grinding.
James Barnett
39,199 PointsJames Barnett
39,199 PointsRather than a screen shot just post your code and a link to the code challenge.