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

Call alert

How do I call the alert() function in html

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

2 Answers

Your code needs to be inside a script tag. Like

<script>alert("Help!")</script>

The first part of the challenge is to just put the script tags into the body of the html.

<script></script>

The second part of the challenge requires you to add the alert warning. This is the part that you are stuck on. alert("Warning!"); should be placed between your script tags in the body. You are missing a > on your script tag and you have ' instead of " around your warning. Your code should look like this:

<script>alert("Warning!");</script>