Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Introducing JavaScript Link to an External Script

I need a mentor.

I need help understanding the symbols used in programming. I understand the call function of (), I understand what variables are. but i'm getting stuck with everything else. is there something I can read or do to improve my skills so I can get thru this class? I understand every language has it's syntax. i'm trying to work my way thru wordpress now. I really appreciate everyone's help. I cannot lose this opportunity. thank you

index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<body>
"alert ("I DID IT!");<>/script>.


</html
shout.js

2 Answers

Josh Olson
Josh Olson
13,236 Points

As far as syntax is concerned, the majority of HTML tags consist of opening and closing tags. A few of these are known as self closing tags.

In your code html, head, and body all require a closing tag. Some self-closing tags are meta, br, and doctype.

So set it up like this...

   <html>
   <head>
   </head>
   <body>
   </body>
   </html>

Then when you have a tag inside a tag, such as head and body being inside html, this is known as nesting. By convention you tab over nested tags for readability.

   <html>
      <head>
      </head>
      <body>
      </body>
   </html>

When you want to use Javascript inside an HTML file, it must be inside a <script> tag which is not self closing. You also usually want to put script tags at the bottom of the body, as it can cause the page to delay loading if it's a long script.

   <script>
      alert("I did it.");
   </script>

Just work on that and you'll be off to a good start.

For further reading. https://www.w3schools.com/html/html_elements.asp

thank you josh. it still won't accept my alert