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
This video covers one solution to the refactor challenge.
This video doesn't have any notes.
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
For instance, you can see that this
code here is the same as this code and
0:00
this code,
it's the same code repeated ten times.
0:05
Before I go into how to optimize the code,
I'll start with the code at the top.
0:08
I declare five variables at
the beginning of the script.
0:12
The html variable is set to an empty
string, and the other four variables
0:16
are not assigned a value, their values are
going to be assigned later in the script.
0:21
I'll start by removing nine
of these sets of code.
0:25
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