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

JavaScript JavaScript Basics (Retired) Introducing JavaScript Write Another Program

What am I doing wrong??

I try to add the alert dialog box it no longer passes the first task. What am I doing wrong?

index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
  <script>"Welcome to my web site"</script>
  <script>alert('Warning');</script>
</body>
</html>

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

You should have only one script tag, the one with alert(). The one you have before it isn't really proper, and you should remove it.

Roy Penrod
Roy Penrod
19,810 Points

You have script tags around the welcome message. The welcome message isn't JavaScript code.

This is what the code should look like:

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

Note: I checked the above code in the challenge and verified that it passed.