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

What is the answer to this Javascript quiz question?

In the JavaScript Loops, Arrays and Objects quiz - Review for loop and loop exiting. There was this question. I am stumped. Can anyone tell me what the answer is? The blank _____ spots is where the answers would go.

Complete the code below to create aΒ forΒ loop that executes 10 times, writing the value of the variable i to the document each time:Β 

_____ (var i = 0; i < _____ ; i += 1) { document.write(i); }

My answer was this:

for (var i = 0; i < 10 ; i += 1) { document.write(i); }

nitin suresh
nitin suresh
5,691 Points

Your answer seems right. It totally depends on you. Make Sure you use number 0 instead of string O.

nitin suresh
nitin suresh
5,691 Points

Actually, this is correctly printing 0 to 9 in my browser. It would be helpful if you could provide link to the challenge.

2 Answers

One of these 6 quiz questions has the question I posted above. Please check out the link if you have a chance.

Steven Parker
Steven Parker
229,783 Points

I did, and confirmed that your answer is correct (the quiz said "well done!").

Steven Parker
Steven Parker
229,783 Points

Your answer is correct. Be sure to enter only the word in the first blank, only the number in the second blank, and no additional spaces or punctuation.

If you still can't get a "well done" response, you might want to contact Support.