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 Write Another Program

Agnes Caringal
Agnes Caringal
6,239 Points

Open an alert dialog with the message 'Warning!' What's wrong with my JavaScript code?!

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

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

3 Answers

Ryan Field
PLUS
Ryan Field
Courses Plus Student 21,241 Points

Hi, Agnes. The alert dialog inside your <script> tags is fine, but the challenge may be failing because you misspelled src in the previous script tag as scr.

Ryan Field
Ryan Field
Courses Plus Student 21,241 Points

Oh, I see what's wrong, I think. You have this:

<script scr="scripts.js"></script>

which you don't need. It's fine to have it in an actual website, but for this challenge, it's unnecessary.

Agnes Caringal
Agnes Caringal
6,239 Points

ah, but that's the answered for the 1st challenge

Ryan Field
Ryan Field
Courses Plus Student 21,241 Points

The first part of the challenge is just to put a pair of script tags inside the body. You don't need to put anything in them, just this:

<script>

</script>

The second part is where you add your alert dialog:

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