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 trialSeth Blanchard
3,753 PointsIs there something I am missing that is causing this Javascript code challenge error?
The first task gets a "well done" but then I get an error in the second section saying that task one is no longer working. Do I have some syntax error in the conditional statement I am not seeing or is this a bug?
var answer = prompt('What is the best programming language?');
if (answer.toUpperCase() === 'JAVASCRIPT') {
alert('You are correct');
}
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="app.js"></script>
</body>
</html>
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! You're doing well, and your code is functional. However, it doesn't meet the strict requirements of the challenge. The challenge states that the alert should execute if the string is equal to "JavaScript". However, you've gone above and beyond the call of duty here and are checking to make sure that any variant the user enters of JavaScript, JAVscript, javaScript will pass. This is great, but it causes the challenge to fail.
Take a look at the condition it's looking for:
if (answer === 'JavaScript'){
Hope this helps!
Seth Blanchard
3,753 PointsThanks so much, Jennifer. I tried that version multiple times but was asking for 'Javascript', as opposed to 'JavaScript'. What a dummy I am. :-) I appreciate the help!