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

Dan Sullivan
PLUS
Dan Sullivan
Courses Plus Student 7,591 Points

Prompts stop after third question.

Gave up after putting in a lot of alerts with a running total score. Then watched the solution video and pared it down. Problem is everything stops after the answer for the third question is placed. No prompts for the remaining two questions.

var score = 0;

var quesOne = prompt("How many players on a football defense?"); if (parseInt(quesOne) === 11) { score += 1; }

var quesTwo = prompt("How many outs in triple play?"); if (parseInt(quesTwo) === 3) { score += 1; }

var quesThree = prompt("Who was buried in Grant's tomb?"); if (toUpperCase(quesThree) === "GRANT") { score += 1; }

var quesFour = prompt("What day is today?"); if (toUpperCase(quesFour) === "THURSDAY") { score += 1; }

var quesFive = prompt("How many innings in a game?"); if (parseInt(quesFive) === 9) { score += 1; }

// output results

document.write("<p>You got " + score + " out of 5 questions right.</p>");

//output rank

if (correct === 5) { document.write("<p><strong>You earned a gold star!</strong></p>"); } else if(correct >= 3) { document.write("<p><strong>You earned a silver star.</strong></p>"); } else if (correct >= 1) { document.write("<p><strong>You have a bronze star.</strong></p>"); } else { document.write("<p><strong>You are an idiot.</strong></p>"); }

2 Answers

Bob McCarty
PLUS
Bob McCarty
Courses Plus Student 16,618 Points

Dan,

The toUpperCase() must be qualified by the var name.

Bob

var quesFour = prompt("What day is today?"); if (quesFour.toUpperCase(quesFour) === "THURSDAY") { score += 1; }