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

Kamila Mielczarek
Kamila Mielczarek
3,294 Points

Why this doesn't pass?

<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JavaScript Basics</title> <script> alert("Warning!"); // why adding this makes task 1 no longer pass? </script> </head> <body> <script src="js/script.js"></script> </body> </html>

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

2 Answers

Logan R
Logan R
22,989 Points

The task wants you to write the code within the body tag using <script> tags.

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

In order for what you wrote to work, you would need to edit a file called script.js in the scripts directory, which you don't have access to.

Kamila Mielczarek
Kamila Mielczarek
3,294 Points

Thanks, it wasn't obvious I was to remove the call to that script! :-)