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 Solution

keren lerner
keren lerner
3,561 Points

Why isn't my code working? The prompts don't show up at all. Thanks!

var correctAnswers = 0;

var answerOne = prompt('Where was I born?');

if (answerOne === 'New York') {

correctAnswers +=1; }

var answerTwo = prompt('Where do my parents live now?');

if (answerTwo === 'NYC') {

correctAnswers +=1; }

var answerThree = prompt('What is my cat called?');

if (answerThree === 'Pete') {

correctAnswers +=1; }

var answerFour = prompt('What month was niece born in?');

if (answerFour === 'June') {

correctAnswers +=1; }

var answerFive = prompt('What month was Dad born in?');

if (answerFive === 'October') {

correctAnswers +=1; }

document.write ('You got ' + correctAnswers ' right!');

2 Answers

Mark Casavantes
PLUS
Mark Casavantes
Courses Plus Student 13,401 Points

Keren,

document.write ('You got ' + correctAnswers ' right!'); should be document.write ('You got ' + correctAnswers + ' right!'); You are missing a + sign after correctAnswers. Sometimes it is the little things that get in the way. I couldn't find anything else wrong. I hope this is what you needed.

keren lerner
keren lerner
3,561 Points

Thanks Mark, that fixed it! Does an error in a part of the code really cause the entire file not to run inJavascript? How does that work? Thanks again!

Mark Casavantes
PLUS
Mark Casavantes
Courses Plus Student 13,401 Points

Karen,

Yes, one mistake can make everything not work. As you do more coding you will be better at picking out many of your errors. I get stuck not being able to find what I have done wrong as well.

Glad to help.