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

renedoukhan
renedoukhan
4,761 Points

Why is task one no longer passing ?

Why :(

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

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

3 Answers

Jesus Mendoza
Jesus Mendoza
23,289 Points

Hey Rene,

If you are not sure how to solve this task I recommend you to watch the previous videos again!

However, in this case you have to open only one <script> tag and add an alert with the text "Warning!" inside of it.

Good luck!

Daniel Gauthier
Daniel Gauthier
15,000 Points

Hey Rene,

You've added two script elements and the challenge only asks for one. You've also added an src attribute with the value of script.js, and while this will become common when working with external JavaScript files, the challenge is focused on creating a single internal JavaScript element.

The following code will pass:

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

Remember that if you add the actual JavaScript code in the same file as the script tag, you don't need to add a src attribute since the src attribute tells the compiler where to find the JavaScript file. Since the JavaScript code is internal in this case, there's no need to look for a different file.

Good luck with the course!

renedoukhan
renedoukhan
4,761 Points

Merci beaucoup.