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 trialSaqib Ishfaq
13,912 PointsAny suggestion/corrections ? before i see the solution video...
so took me a day but completed the challenge and it works as it said:)
var q1 = prompt ('what is England capital?');
var points = 0;
if (q1.toUpperCase() === 'LONDON'){
points+=1;
alert ('thats correct, yor score is' + points);
} else {alert('no you are wrong');}
var q2 = prompt ('what is the world\'s oldest known city?');
if (q2.toUpperCase() === 'DAMASCAS'){
points+=1;
alert('thats correct, your score is ' + points);
} else{ alert('no you are wrong');}
var q3 = prompt ('what is 2+3');
if (q3 === '5'){
points += 1;
alert ('thats correct, you score is ' + points);
} else{ alert('no you are wrong');}
var q4 = prompt ('Did world trade centre twin towers got hit by planes on 9/11?');
if (q4.toUpperCase() === 'YES'){
points +=1;
alert ('thats correct, your score is ' + points);
} else {alert('no you are wrong');}
var q5 = prompt ('which sea does river Jordan flows out into?');
if (q5.toUpperCase() === 'DEADSEA'){
points +=1;
alert ('thats correct, your score is ' + points);
} else {alert('no you are wrong');
}
document.write ('<h2>so you got ' + points+ ' questions right. </h2>');
if (points === 5){
document.write ('<p>You have earned Gold Crown!</p>');
} else if (points ===4 || points ===3){
document.write('<p>You have earned Silver Crown!</p>');
} else if (points === 2 || points === 1){
document.write('<p>You have earned Bronze Crown!</p>')
}
else { alert ('your score is ' + points +' you Suck!!');}
3 Answers
Steven Parker
231,236 PointsHaving a working solution is all you need to proceed to the solution video.
But when posting code to the forum, always use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. Or watch this video on code formatting.
Saqib Ishfaq
13,912 Pointsjust did thanks
Steven Parker
231,236 PointsIf you put the letters "js" after the first 3 backticks, you'll also get syntax coloring.
Saqib Ishfaq
13,912 Pointsawww better! i tried writing "javascript" as in the video , but dint work...but ur shortcut surely does..thanks appreciate ur guidance!!
Saqib Ishfaq
13,912 PointsSaqib Ishfaq
13,912 PointsThanks for the video link, i had a look and i'll be using that from now on for any ques..........:)