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

Samuel Igborgbor
Samuel Igborgbor
4,335 Points

When i answer the second Task in the "write another program" task, it says "Oops! It looks like Task 1 is no longer pass

Task 1: <script src="scripts.js></script>

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

3 Answers

Steven Parker
Steven Parker
231,268 Points

I see two issues:

  • the challenge did not ask for a src attribute to be added to the tag
  • the task 2 code should be added between the script tags already there from in task 1

When done, you'll have just one set of script tags, located in the body, with no "src" attribute, and the code will be between them.

Hey there Samuel. You are very close! The two things going on in this challenge were:

  • Task 1: Add Script Tag between the Body tag
  • Task 2: Inside the Script tag write a function ....etc.

The script tag in the head element is not needed. Simply move your alert function between the script tags in the body and ditch the src = "script.js"

I hope this helps!

Samuel Igborgbor
Samuel Igborgbor
4,335 Points

Already figured it out. Thanks Steven and Evan