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

I followed the video and code exactly and the circles are still not showing

Below you can find my code for the index.html and scripts.js files.

For some reason I still do not get anything displayed on the preview page.

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 scr= "js/script.js" ></script> </body> </html>

scripts.js

var html = '';

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

Thank you for help. John

Adam Beer
Adam Beer
11,314 Points

Please rewrite your code section and use 3 backticks (```) on the line before and after.

Code

Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

      ```html
      <p>This is code!</p>
      ```

3 Answers

Adam Beer
Adam Beer
11,314 Points

Inside your HTML page. Correct your

<script scr= "js/script.js" ></script>

to

<script src= "js/script.js" ></script>

Hope this help!

Tsenko Aleksiev
Tsenko Aleksiev
3,819 Points

@Adam Beer you were faster :) GG!

Adam Beer
Adam Beer
11,314 Points

Too simple, though, I was thinking a lot about it. :D The point is, we found it :)

Tsenko Aleksiev
Tsenko Aleksiev
3,819 Points

Is this your code

<!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 scr= "js/script.js" ></script> 
</body>
</html>

JS

var html = '';

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

It should print the numbers from 1 to 10 right? Look at your script tag: the SRC is misstyped, you have writen SCR :)

Thanks guys, yeah I scrubbed it and just couldn't find it.