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 trialfadi walter
2,785 Pointsstill showing a blank page even after i did the exact same code ???? var html = ' '; for (var i = 1; i <=10; i += 1){
why still shoeing a blank page even after i did the same exact code ???? var html = ''; for (var i = 1; i <=10; i += 1){ html += '<div>' + i + '</div>'; } document.write(html);
7 Answers
Michael Stedman
Full Stack JavaScript Techdegree Student 13,838 PointsOkay, as above in the thread, it seems that fadi walter was able to figure it out as they made a post putting the code in the original post into the code format. Which, there was also one or two changes made. The one thing that I noticed in the original code was that there was a double quote at the end of the first variable declaration:
var html = ";
But later on in the thread when the OP finally put it all in the code format, this was changed to the correct var html = ' ';
I tested both codes. The first way, with the single double quote reacted in the preview the same way the OP described, however, dropping the single double quote, and using the single quotes, the code ran fine.
Alexandros Vasileiou
1,009 PointsMake sure that you created the script.js file inside the js folder. If you didn't then either move it inside the folder and keep the <script src="js/script.js"></script> in your index.html file or change it to <script src="script.js"></script>
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsIt might be a problem in your html page - might forgot to add the script or something
fadi walter
2,785 Pointsi did check the code more than one time. nothing seems to be wrong in the code i believe.
Simon Morris
16,250 Pointscan you post your code?
fadi walter
2,785 Pointsvar html = ' ';
for (var i = 1; i <=10; i += 1){
html += '<div>' + i + '</div>'; }
document.write(html);
Bryant Feld
Full Stack JavaScript Techdegree Student 26,144 Points<!DOCTYPE html> <html> <body>
<h1>checked your code on JSfiddle</h1> <p>it seems to be working.</p>
<script> var html = ' '; for (var i = 1; i <=10; i += 1) { html += '<div>' + i + '</div>'; } document.write(html); </script>
</body>
Ashi A
2,531 Pointsdid you check your path for the .js file?