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

Javascript Foundations Getting and Setting code challenge 2 of 2

Really frustrated on this challenge been struggling for the past hour and have been re watching the video a couple of times.

It is just not clicking the question is

On about line 18, set the 31st element in 'myArray' to the word 'treehouse'

and what ever i put in i get The 'myArray' length is 6 not 31.

Here is the code

var myArray = ["sugar", "rush", "fix", "it", 3.14, 42];
  var thirdElementInArray = myArray[2];

one code i did enter in line 18 my_array[my_array.length] = "treehouse" ;

aswell as

my_array[31] = "treehouse" ;

and

my_array[30] = "treehouse" ;

Any help would be appreciated thanks Scott :)

3 Answers

myArray[30] = "treehouse";

you have an Underscore

Brilliant thanks Graham , I used the similar names in my notes and used them in the exercise oops , now seeing it in front of me it makes sense.

Scott

No worries Scott - pleased I could help.

G