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 trialMark Westerweel
Full Stack JavaScript Techdegree Graduate 22,378 PointsArrays Quiz doesn't accept correct code (I tripled checked in browser console). Anyone experienced the same?
So far I tried entering correct code ( it was about the position number in an array -yes, counted from 0- checked multiple times) and the push() method that worked, and the next question that didn't accept the unshift() method.
The first question mentioned I should use the array name and position like 'players[1]' for example. Which I did.
The second question strangely asked if I used a push() method (while I entered array.unshift()) and when I tried the suggested push() it suggested a unshift(), which I did and it suggested once more a push(), while it needed to be a unshift(), as we were told to add two names to the beginning of the array.
So far really happy with the course, but this is really annoying.
p.s. I can't clearly state enough that my code worked perfectly in sublime, VS and Chrome.
3 Answers
Mark Westerweel
Full Stack JavaScript Techdegree Graduate 22,378 PointsI posted it underneath the wrong quiz.
It's are the two objectives(where you have to type in code,not the multiple challenge questions) If you scroll up to the progress gauge, it are the 4th and 7th sphere respectively.
Steven Parker
231,248 PointsBe careful when testing challenges with external IDEs. It's easy to get a "false positive" if you misunderstand the objective.
For task 1 of the Access Array Elements by Index challenge, the instructions say to "Start by logging the first name inside the array...". But logging "players[1]
" would not be correct since index values begin at 0, so a "1" would be a reference to the second name.
For the Add Elements to an Array challenge, please show the exact code you entered and then I can comment further.
Mark Westerweel
Full Stack JavaScript Techdegree Graduate 22,378 PointsAm not talking about the first task, but thank you for your time to reply.
Will take it up through Slack .
Steven Parker
231,248 PointsFor task 2 of the first challenge, the instructions say "log the last element..." so "console.log(players[1]);
" would also not be correct because the array has 6 elements. The index of the last one would therefore be 5 .
If you don't find what you need on slack, just show your exact code here and you can get precise answers here.
Mark Westerweel
Full Stack JavaScript Techdegree Graduate 22,378 PointsOk, super silly and totally my bad. facepalm
Didn't use the second line of code underneath the first. As mentioned in the grey comment.
Code worked.
Memo to self: don't delete the previous code from the assignments
Steven Parker
231,248 PointsThe challenges will remind you. The all initially display this instruction:
Important: In each task of this code challenge, the code you write should be added to the code from the previous task.