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,269 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,269 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,811 Points

@Adam Beer you were faster :) GG!

Adam Beer
Adam Beer
11,269 Points

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

Tsenko Aleksiev
Tsenko Aleksiev
3,811 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.