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 trialDarian Wilkin
3,568 PointsSupport just gives me a canned response, can anyone tell me how to fix this?
Very frustrated right now as I've had numerous issues with this course, and when I sent in a request for support with screenshots and exhaustive details on the issue I was met with a 3 sentence canned telling me to ask the community, even though I explained that the "Get Help" button was broken on the portion I was actually having trouble with (It does nothing when you click it). Then when I asked a followup question they completely ignored me for going on three weeks now. So here goes:
I can get past the first portion of this test with the first line, then the second portion comes up and when I add lines 2 through 6 it tells me line 1 is no longer passing. Nothing I do from that point can fix the problem. I've tried about 30 different syntax changes to find the issue and I firmly believe at this point that it's a problem with Treehouse, but again I have NO IDEA because Treehouse support just can't be bothered.
var answer = prompt('What is the best programming language?');
if (answer.toUpperCase() === 'JAVASCRIPT' ) {
alert("You are correct");
} else {
document.write("<p>Sorry, that's not right</p>");
}
<!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
tobiaskrause
9,160 PointsPlease follow this path always when you have problems: Google your question use stackoverflow or the documentation of your language -> Ask the treehouse community -> Ask a teacher if needed -> .... -> ask the support of there is something buggy in the challange
Now to the solution: You thing way...way more complicated. This is one of the JavaScripts basic challanges ... which should be fairly easy. You write code that you might use after the next course :)
Here is the quiet simple solution
var answer = prompt("What is the best programming language?");
if (answer === 'JavaScript') {
alert("You are correct");
} else {
alert("JavaScript is the best language!");
}
Nothing need to be done in the Html Some tips
// already here you did more than the challange wanted from you...so it will fail
// also the else statement...you did far more than the instruction said
if (answer.toUpperCase() === 'JAVASCRIPT' )
Jennifer Nordell
Treehouse TeacherHi there! The problem here isn't really with Treehouse. It's that you've gone above and beyond what they're asking you to do. You're converting the answer to uppercase and then comparing it with JAVASCRIPT
, which in a normal project would be ideal.
It's important to note that when doing challenges you must follow the instructions to the letter. Any deviation from this can cause the challenge to fail, even if functional outside the challenge. Here was my solution:
var answer = prompt('What is the best programming language?');
if(answer === "JavaScript") {
alert("You are correct");
} else {
alert("Javascript is the best language!");
}
Hope this helps!
Darian Wilkin
3,568 PointsThank you Jennifer, Tobias beat you by like a minute! Both of your answers are correct, the previous lesson added the "toUpperCase" method so I thought it was needed here, still frustrating that it A) Gave such unhelpful errors and B) the "Get Help" button wouldn't work, but at least the code challenge is complete now!
Jennifer Nordell
Treehouse TeacherDarian Wilkin you're quite welcome! And as I understand it, the tech support is working on the "Get Help" button. But when you get stuck, the best place to come first (after looking at documentation) is to the Community. There's a great bunch of people here!
tobiaskrause
9,160 PointsTo be fair: Most people here have issues because the dont read carefull enough. Or they test their code with their IDE/compiler and wonder why it is working but not in the challange.
But when you have a customer one day you can't just say "Hey what do you want...it compiles there are no errors in my code...what you wanted something completely different?" :D A reason could be, that the challanges are too small...people think they just have to invest 5 minutes for each one. Also the difficult level in the beginning is quiet low since you just have to do the same as in the videos. People then often think that they will alaways just have to copy the stuff from the video
Darian Wilkin
3,568 PointsAnd I get that, the issue here was that the error messages given as to why it was failing were completely unhelpful. It told me that when I added my second bit of code (everything past line 1) that the first test was no longer being met, which doesn't seem to be the case. I think it's more likely the way that condition was being tested was messed with by toUpperCase somehow. So that was my primary cause of frustration, because the "customer" in this case just wasn't telling me what they wanted! ;)
Darian Wilkin
3,568 PointsDarian Wilkin
3,568 PointsThank you for the help, I could have sworn there was a portion where it told me to use toUpperCase... but it's not requiring it now, and that worked! The really frustrating part was just that it kept telling me part one was messed up each time I tried to run my code, and the "Get Help" button wouldn't work once I'd submitted my first bit of code (still have that problem, but oh well). I'm sure I got a bit too heated but thanks again :)