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

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,242 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,242 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,242 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>