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 JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops For Loops

UHHH... It doesn't work.

I wrote all this code as said in the video but nothing except for a empty page shows. Here is the code:

var html = '';

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

Please someone tell me fast.

4 Answers

<!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/script.js"></script>
</body>
</html>
Alexandra Barnett
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexandra Barnett
Front End Web Development Techdegree Graduate 46,473 Points

Which browser are you using? Perhaps it's been cached and you aren't seeing the updated version...otherwise I'm not entirely sure because it should work...I'm sorry I can't be of more help :(. I find that, on Google Chrome, I have to sometimes open the developer console and do a "hard reload" by pressing command+R or clear the browsing data from the settings...

Oh sorry actually I didn't put the file in the folder. I am really sorry for disturbing you.

Garrett Freshwater
Garrett Freshwater
2,378 Points

Haha, I was having the same issue as you Sufiyaan. Also, same solution. Thanks!

Yeah, I was like what the hell????????