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

My work did not get displayed. Can someone have a look and help advise please?

Here's how my script.js looks:

var html = ''; var red; var green; var blue; var rgbColor;

for (i = 1; i <=10; i+=1) { red = Math.floor(Math.random() * 256); green = Math.floor(Math.random() * 256); blue = Math.floor(Math.random() * 256); rgbColor = 'rgb(' + red + ',' + green + ',' + blue +')'; html += '<div style = "background-color:' + rgbColor + '"></div>'; } document.write(html);

Here's how my .html looks:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" href="css/main.css"> <title>The Story Maker</title> </head> <body> <div class="container"> <script src="script.js"></script> </div> </body> </html>

Can someone help spot something wrong that prevents the display of my work? Much appreciated.

Steven Parker
Steven Parker
243,656 Points

Posted code will not display correctly without blockquoting it. Skip a blank line, the put a line with only 3 accents and the language (```js or ```html) to start, then your code, then end with another line having only the 3 accents.

Better yet, use the snapshot function in the workspace and provide the link to that.

1 Answer

Hi Steve, thanks for getting back. My work does work using Workspace but when I switch to Atom it doesn't work anymore and shows a blank screen instead. Does this have anything to do with the tool? Thanks

Steven Parker
Steven Parker
243,656 Points

I'm not familiar with "Atom" - perhaps someone who is will chime in next.