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 trialRahim Spencer
5,772 PointsAm I missing something?
Tried following along with the video, but can't seem to get this right. Can anyone see what i'm doing wrong?
var html = '';
for ( var i = 1; i <= 10; i += 1 ) {
html += '<div>' + i + '</div>';
}
document.write(html);
Thanks! R
3 Answers
Alexandria Wagner
7,038 PointsHi Rahim,
Your code works as it is to print the numbers 1 through 10. You might be having some trouble with Workspaces. If you would like more resources to test your code, you can use JS Bin or the JavaScript console in Chrome Dev Tools.
I hope this helps, Alex
Frank Ruiz
15,558 PointsFor anyone else having trouble, double check to make sure the file "script.js" matches the file in the "index.html" code.
marco berardini
3,393 PointsHad a similar issue when I created my script file (ctl clicking file JS )it actual was created in the main body of the program. Drag and drop file into js and everything works fine.
Rahim Spencer
5,772 PointsRahim Spencer
5,772 PointsOhh I see. Was going crazy trying to figure out what was wrong. Thanks for taking a look!