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

inside the script tag

how do i write a function that will open an alert dialog with message warning!

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

<script> 'alart("warning")
</html>

1 Answer

Christopher Jr Riley
Christopher Jr Riley
35,874 Points

Actually, you have all the code that you need in order to pass the challenge! You just need to do some cleanup.

  1. On the part where it says "<script> 'alart("warning")", just remove "<script>". Remove the apostrophe as well (This: ')
  2. The line that says "<body> <script> </script> </body>": put each of the tags into separate lines.
  3. Remember that in order for the JavaScript code to work, it will need to be inside the "script" tags. With that in mind, put "alart("warning")" in between the "<script> </script>" tags.
  4. Finally, you misspelt "alert". Just change the second "a" with an "e". It should look something similar to this:
alert('Warning!')

In the end, it should look something like this:

<!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>

Hope this helps!

thank you it worked