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 The Conditional Challenge

Kayla Larson
Kayla Larson
1,222 Points

I am not sure why this code isn't working properly - it keeps saying the answer as being incorrect:

' ' ' var questionTwo = prompt('In Japanese, what is the name for goodbye?'); questionTwo = 'SAYONARA'; if (questionTwo.toUpperCase === 'SAYONARA') { score ++; alert('Correct! Now you have ' + score + ' points.'); } else { alert('Incorrect. Better luck next time.'); } ' ' '

Kayla Larson
Kayla Larson
1,222 Points

I guess I didn't complete the markdown cheatsheet portion right either :/

1 Answer

Brendon Butler
Brendon Butler
4,254 Points

I put a comment on the line that I think may be your problem. You promt the user for their input, but then you set it and ignore their input

var questionTwo = prompt('In Japanese, what is the name for goodbye?');
questionTwo = 'SAYONARA'; // THIS LINE

if (questionTwo.toUpperCase === 'SAYONARA') {
    score ++;
    alert('Correct! Now you have ' + score + ' points.');
} else {
    alert('Incorrect. Better luck next time.');
}
Kayla Larson
Kayla Larson
1,222 Points

Thank you! So if I just remove that, it should work properly this time? I just thought I needed to have the correct response written as well to let the computer know what it was.. but makes sense over all. Thank you again!

Brendon Butler
Brendon Butler
4,254 Points

I havent tested it, but I would assume it would work. Let me know though!

This line is where you input the correct answer to compare it to the user's input

if (questionTwo.toUpperCase() === 'SAYONARA')
Kayla Larson
Kayla Larson
1,222 Points

Yes, and I just realized that I need to make it .toUpperCase with () at the end. I forgot that and that's why it wasn't initially saying it was correct. Thank you!