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

Scripts

What am I doing wrong?

Inside the script tags, write a function that will open an alert dialog with the message Warning? (in case you can't see my code)

<script src ="scripts.js"></script> <script src= "apps.js"> </script> <script> alert ("Warning"); </script>

^^^^This tells me ? 1 is no longer correct but produces an alert warning box. ^^^^

<script src= "scripts.js"> </script> <script> alert ("Warning") </script>

^^^^I believe this one reported a syntax error^^^^

If your alert is inside the script tags: <script> alert("Warning!") </script>

it should have worked (with or without the exclamation mark).

2 Answers

Edgar Gil
Edgar Gil
13,322 Points

Maybe try alert without the space ex: alert ("Warning"); //-> This is what you show us. alert("Warning"); //-> you should try this.

If is asking you to make a alert function then try that code below.

function myFunction () { alert("Warning"); }

Hope this help. Good luck!.

Roy Penrod
Roy Penrod
19,810 Points

Here's the code I used to pass the challenge:

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

It passes the challenge with or without the semi-colon at the end, but you should get in the habit of ending every JavaScript statement with the semi-colon.