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


Jimmy Miller
Jimmy Miller
283 Points

Got a Javascript Question

I got this HW problem im having a tuff time getting my head around.

Heres what it says,

Create a new document in your text editor, and type the strict DTD <!DOCTYPE> declaration, <html> element, document head, and <body> element. Use “Largest Islands” as the content of the <title> element. Add the following <h1> element to the document body: <h1>Largest Islands</h1>

Add the following script section to the end of the document body: <script type="text/javascript"> /* <![CDATA[ / / ]]> */ </script> In the script section, type the following statements that declare variables containing the names and sizes of the world’s five largest islands:var island1Name = “Greenland”; var island2Name = “New Guinea”; var island3Name = “Borneo”; var island4Name = “Madagascar”; var island5Name = “Baffin”; var island1Size = 2175600; var island2Size = 790000; var island3Size = 737000; var island4Size = 587000; var island5Size = 507000;

When it says in the script section, what does that mean and where are they asking to put it?

Next, add the following statements to the end of the script section that print the values stored in each of the variables you declared and initialized in the last step:

document.write(“<p>The largest island in the world is ” + island1Name + ” with ” + island1Size + ” miles. </p>”); document.write(“<p>The second island in the world is ” + island2Name + ” with ” + island2Size + ” miles. </p>”);

document.write(“<p>The third island in the world is ” + island3Name + ” with ” + island3Size + ” miles.</p>”);

document.write(“<p>The fourth island in the world is ” + island4Name + ” with ” + island4Size + ” miles.</p>”);

        document.write("<p>The fifth island in the world is "
            + island5Name + " with " + island5Size +
            " miles. </p>");

Save the document as LargestIslands.html in the Exercises folder for Chapter 1 and then open it in your Web browser and examine how the elements are rendered. Close your Web browser window, but leave the LargestIslands.html document open in your text editor.

Thanks for the help guys!!!!!

2 Answers

Matthew Ong
Matthew Ong
6,041 Points

When they say script section they are probably just referring to the section in between two script tags

Yay teamwork! :D