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 Loops, Arrays and Objects Tracking Multiple Items with Arrays Removing Items from an Array

Muzafar Haq
Muzafar Haq
14,272 Points

Quiz Question: JavaScript Loops Arrays & Objects

Complete the code below to store the number of items in the array scores into the variable totalScores:

var scores = [ 76, 79, 85, 87, 89 , 90, 99]; var totalScores = scores. ___________;

I did not understand the question, is it asking for adding any number which is more than 99. I wrote push (110) to say but got an incorrect answer.
As this was the last question on my quiz, I did not even get to see any teacher's comment for a wrong answer as there was a pop-up that appears about the score (12pts) and move on to next video... There should be a way to find out the answers to incorrect question at the end of the quiz, only if the answers = to the passing answers so that at least we know why the answer was wrong and what is the right answer to it.

6 Answers

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

to store the number of items in the array scores into the variable totalScores:

This question is asking you to count how many items are on the scores array, and store the result to variable totalScores.

var totalScores = scores.length
Muzafar Haq
Muzafar Haq
14,272 Points

oh I got it, the code challenge following this quiz was a similar one, and i did passed in first attempt. Maybe I did not read the question carefully. Thank you William :)

Yosef Ali
Yosef Ali
15,182 Points

Thank! William

Thanks for this answer and question