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 trialashmagupta
6,595 PointsWhen i put alert in the shout.js file, src file no longer responds
When i put <script> alert("I did it")</script> in shout.js file, <script src="shout.js"> </script> gets inactive.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="shout.js"> </script>
</body>
</html>
<script> alert("'I did it'") </script>
2 Answers
andren
28,558 PointsScript tags are only used when embedding JavaScript code within an HTML file. When writing JavaScript code within a JavaScript file you don't use them. Also you don't need both double quotes and single quotes when creating a string. You should go with one or the other.
If you remove the tags from the shout.js file like this:
alert("I did it") // Removed script tags and switched to only using double quotes (")
Then your code will work.
Kyle Johnson
33,528 PointsHi Ashma!
You have the right code to cause an alert to appear.
alert('I did it!');
But you have extra html tags in your shout.js that shouldn't be there.
<script></script>
Once you remove the script tags and add a semi-colon to the end of the line you will pass the challenge. You're code should look like this in the shout.js:
alert('I did it!');