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

Calvin Secrest
Calvin Secrest
24,815 Points

Inside the script tags, write a function that will open an alert dialog with the message 'Warning!'

I cant find out if my script is set up properly?

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="scripts.js">
alert("Warning");
</script>
</body>
</html>

7 Answers

Mikkel Rasmussen
Mikkel Rasmussen
31,772 Points
<script>
alert("Warning!");
</script>
Mikkel Rasmussen
Mikkel Rasmussen
31,772 Points

You don't need to make src to a javascript file.

Calvin Secrest
Calvin Secrest
24,815 Points

The code text in index.html mention is I put it that way then task 1 is wrong and no longer passing. Where inside the code text does this script is place?

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

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

Learning coding
seal-mask
.a{fill-rule:evenodd;}techdegree
Learning coding
Front End Web Development Techdegree Student 9,937 Points

After writing this code the folowwing happens:

  • A grey box (message) appears with text in it: An embedded page on preview.treehouse-challenges.com report the following: Warning!

  • When I click on ok in the the textbox mentioned above it says that task one doesn't pass.

What is happening here and how can I pass the task?

The script is correct, you just need to remove the semicolon at the end. Hence: alert("Warning!");

Change to: alert("Warning!")

August Oliver
August Oliver
5,933 Points

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

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