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

Gavin van Hoeijen
Gavin van Hoeijen
2,938 Points

https://teamtreehouse.com/library/what-are-loops Copied code from solutions to workspace; this script does not work.

Hey all!

So I noticed when filling in the script it did not work in my browser. The browser is called Brave, which is chromium based.

So I started debugging but I failed. And so I downloaded the solution for the video. This is my current code, based upon the downloaded solution but the problem still persists. I also tried this solution in Chrome and this did not solve it.

script code looks like:

function randomNumber(upper) { return Math.floor( Math.random() * upper ) + 1; } var counter = 0; while ( counter < 10000 ) { var randNum = randomNumber(6); document.write(randNum + ' '); counter += 1; }

HTML code looks like:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Let’s Make Random Numbers</title> <link rel="stylesheet" href="styles.css"> </head> <body> <h1>Let’s Make Random Numbers</h1> <script scr="scripts.js"></script> </body> </html>

Gavin van Hoeijen
Gavin van Hoeijen
2,938 Points

I see that this course is retired, I'm following the other courses that replaced it and see how it goes from there. I still like to know the answer, so feel free to answer. Have a great day!

2 Answers

Steven Parker
Steven Parker
231,269 Points

It looks like the only issue is a misspelled attribute name in the HTML file, preventing the JavaScript from loading:

  <script scr="scripts.js"></script>  <!-- original code -->
  <script src="scripts.js"></script>  <!-- fixed "src" attribute spelling -->
Gavin van Hoeijen
Gavin van Hoeijen
2,938 Points

Ha thanks for the fast response, that one flew over me even after looking at it 10 times in a row. Perhaps I should make a loop for that. ;) Thanks for the help!