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

JavaScript Basics - Conditional Statements Challenge 1

For one reason or another, I seem to be getting an error whenever I submit my answer. Everything seems to work correctly in the browser window, so I am not sure why I am not passing this challenge. Here's my code:

var answer = prompt('What is the best programming language?'); if (answer === 'Javascript') { alert("You are correct"); }

Challenge Task 1 clears just fine, but Challenge Task 2 returns an error asking if I used the === operator to compare answer and the text string. Any help would be awesome!

Something else to think about is this... there could be many answers to the question depending on how the person types it in.

Javascript, JavaScript, javascript, JAVASCRIPT, or js, etc.

So that's one thing you'll want to consider when you're programming something like this (and I think, if I remember correctly, the teacher goes over one way to solve this later on)... :)

1 Answer

Solved - The if statement had to read if ( answer === "JavaScript" ) { . . .

I was missing that second capital S

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hi Jonathan.

I have changed your answer into a comment, this way you can mark it down as best answer and the question will be marked as resolved!

Good Spot, you were very quick in finding the bug!!

Vittorio