Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Loops!
You have completed JavaScript Loops!
Preview
Use a `for` loop to build a string holding HTML, then display it on a web page.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You'll create a loop that adds 10 div
elements to a webpage with numbers
0:00
inside them.
0:01
In other words,
use a for loop to repeat the same action,
0:02
adding a div to the page 10 times.
0:05
The divs are styled with CSS to display
as circles with white background colors.
0:07
To code along with me,
open the file html-loop.js and
0:11
make sure to update the script tag in
0:18
index.html to point to js/html-loop.js.
0:21
In this file,
0:27
there's already a variable named main that
points to the main element in index.html.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up