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 trialJoey Song
Courses Plus Student 773 PointsI answered, "Open an alert analog with the message "warning" with alert ("warning"); but still is saying i'm wrong. why?
jsrjh
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
alert("warning");
<script>
alert("Welcome back from treehouse);
<script>
alert("warning");
</html>
5 Answers
Andrew Rickards
18,877 PointsThe first alert is outside the script tag. And the second script tag isn't a closing one. You are also missing the closing quote on "Welcome back from treehouse" Try;
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<script>
alert("warning");
alert("Welcome back from treehouse");
alert("warning");
</script>
</html>
Andrew Rickards
18,877 PointsAre you meant to put the alert in the script.js file instead of the HTML file?
Joey Song
Courses Plus Student 773 PointsIt seems like it but then again I can't access any HTML file because its a challenge quiz. It just says to open an alert analog with the message but doesn't specifically tell me where to put it.
Joey Song
Courses Plus Student 773 Pointshow can I show you screenshot of all my codes again? to show you what I changed?
Andrew Rickards
18,877 PointsWhich code challenge is it? I'll have a look.
Joey Song
Courses Plus Student 773 PointsNot certain which one exactly but its the first challenge for introduction to javascript. Stage 1 introducing javascript?
Andrew Rickards
18,877 PointsThe script tags need to go inside the body.
<!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>
Joey Song
Courses Plus Student 773 PointsJoey Song
Courses Plus Student 773 Pointsthank you for replying Andrew. My mistake the first question asked me to type "script src="scripts.js"></script> and got it right and 2nd question now is asking me to open an alert analog with the message "warning" but the hint says the code should be added to the code written in the previous task. I thought you can only have one file per script? I typed alert("warning"); on the next line below my first answer and still is wrong answer.