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) Making Decisions with Conditional Statements Introducing Conditional Statements

Melker Holmgren
Melker Holmgren
2,065 Points

Cant pass stage 2 in test: Javascript Basics - conditional statments

test: https://teamtreehouse.com/library/javascript-basics/making-decisions-with-conditional-statements/introducing-conditional-statements-2

I pass stage one with this code: var answer = prompt("What is the best programming language?");

when i go to part 2 of 3 and type this code:

var answer = prompt("What is the best programming language?"); <-- this line get error message: -"Oops! It looks like Tasl 1 is no longer valid" ???

if( answer.toUpperCase() === "JAVASCRIPT"){ alert("You are correct"); }

I have run this con on JSfiddle and it works perfekt. I have empty browser history and cash. I stll get this message? why?

app.js
var answer = prompt("What is the best programming language?");
if( answer.toUpperCase() === "JAVASCRIPT"){
alert("You are correct");
}
https://teamtreehouse.com/library/javascript-basics/making-decisions-with-conditional-statements/introducing-conditional-statements-2
index.html
<!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>
Peter Mumford
Peter Mumford
7,774 Points

I was getting the exact same error, and couldn't figure out why. Then I reset the quiz, and did the quiz over from scratch, and it passed.

1 Answer

Steven Parker
Steven Parker
231,271 Points

:point_right: Your code "works", but it is not what the challenge asked for.

The challenge asked you to check if the answer is the string 'JavaScript'.

It did not ask you to change case on the answer or to check if the answer is "JAVASCRIPT".

One secret to passing the challenges is to follow the instructions literally and don't get fancy and do extra stuff.