Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
216,083 Points

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

Steven Parker
Steven Parker
216,083 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.