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

Pimwipha Cheaptumrong
Pimwipha Cheaptumrong
10,977 Points

I have a problem with For Loops.

Hi, I am studying For Loop JavaScript session with Dave. I followed along with the exercise and I checked the code every single that has no mistakes. I also check the HTML file and I wrote the js script tag right. However when I checked the preview in Google Chrome. The layout of the text number and grey circle are broken and it doesn't like the outcome result in the video at all. I don't know if I did something wrong. Thank you so much!

var html = '';

for(var i = 1; i <= 10; i += 1) { html += '<div>' + i + '</div>'; }

document.write(html);

1 Answer

Steven Parker
Steven Parker
229,708 Points

By itself, this code would just display numbers in a vertical line on the page. Is there more to this code that you forgot to post (like a CSS component)?

A better way to share your code and make it easy for someone to replicate your issue is to make a snapshot of your workspace and post the link to it here.