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
Houssein Abil
Full Stack JavaScript Techdegree Student 1,047 PointsMy funny code for the challenge
/* Welcome to my second code challenge
this challenge is about a game on 5 facts
that verify if you know me well.
By Houssein, Fullstack Javascript Developer
*/
// starting of the game with 0 score
var score = 0;
//begins of the questions
var score1 = prompt("What is my name ?");
if (score1.toLowerCase() === 'houssein'){
score += 1;
}
var score2 = prompt("What is my favourite programming language?");
if(score2.toLowerCase() === 'javascript'){
score += 1;
}
var score3 = prompt("In which city i'm leaving?");
if(score3.toLowerCase() === 'niamey'){
score +=1;
}
var score4 = prompt("Who is my best friend?");
if(score4.toLowerCase() === 'afdel'){
score +=1;
}
var score5 = prompt("What is my favourite meal?");
if(score5.toLowerCase() === 'dafadouka'){
score +=1;
}
// begins of the scoring
if(score === 5){
document.write("You rock the gold baby, you've found " + score + " questions out of 5");
} else if (score >= 3){
document.write("Try to know me well, you've got the bronze for " + score + " questions out of 5");
} else if (score >=1){
document.write("Are you kidding me ?, You only get " + score + " questions out of 5");
} else {
document.write("Who are you han?");
}
2 Answers
Steven Parker
243,199 PointsYour code looks good.
I don't see anything "funny" in the code itself, it's clean and easily readable.
Now the questions are "funny" because only you would be likely to get them right. I was curious about "dafadouka", but I could find no mention of it on the internet. Is it a real food?
Houssein Abil
Full Stack JavaScript Techdegree Student 1,047 PointsHi Steven, the word doesn't appear on the internet because of its a word in my mother tongue language. The possible another name can "Tchiep Djenn" with a little difference in the cooking.
Steven Parker
243,199 PointsThe internet isn't just english, so it's surprising not to find anything at all for a term in any language. On the other hand, I did find a number of references for your other term, though with various spellings (hieboudienne, thiep bu dinenne, ceebujenn, Tiep bou dien). It does sound interesting and I will look forward to trying it. Perhaps I will try it with Attaya.
Houssein Abil
Full Stack JavaScript Techdegree Student 1,047 PointsHoussein Abil
Full Stack JavaScript Techdegree Student 1,047 PointsYes, you are right. I'im talking about my questions. Now for your question, DAFADOUKA (which means cook all) is the name of a meal in my country. I really cause it is easy to cook and also very tasty. I can share the recipe with you if you want.
Steven Parker
243,199 PointsSteven Parker
243,199 PointsI certainly am curious, and as I said, this word doesn't seem to appear anywhere on the internet except in this question! Is there possibly another spelling?