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 Simplify Repetitive Tasks with Loops For Loops

Loftur Einarsson
Loftur Einarsson
3,591 Points

Does not run

Can't see anything wrong but it doesn't work

scripts.js

var html = '';

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

console.log(html); document.write(html);

index.html

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Circles</title> <link rel="stylesheet" href="css/styles.css"> </head> <body id="color"> <script src="js/scripts.js"></script> </body> </html>

1 Answer

Steven Parker
Steven Parker
231,269 Points

This writes the number 1-10 on the page and also displays the code in the console.

Do you not see that, or were you expecting it to do something else?

Loftur Einarsson
Loftur Einarsson
3,591 Points

Yes, I just added the console.log to see if it was not getting anything through. Nothing was displayed on the page. I think it's a problem with the workspace

Steven Parker
Steven Parker
231,269 Points

You could make a snapshot of your workspace and post the link to it here. The the issue could be examined in the same environment you are working in.