+ 2

16.2 practice exam

var score = parseInt(readLine(), 10) /* 88 and above => excellent 40-87 => good 0-39 => fail */ // your code goes here if (scores <=88){ console.log ("excellent"); } else if (scrore >= 87){ console. log ("good");{ } }else{ console.log ("fail"); else if(score <= 40) console.log("good"); }else{ console.log ("fail"); document.write ("score") }

16th Sep 2022, 4:47 PM
Emmanuel Pena
13 Answers
+ 2
Invert all the <= and >=
16th Sep 2022, 4:54 PM
Roland
Roland - avatar
+ 2
Yes, you have your symbols facing the wrong way. A < B = A is less than B A > B = A is greater than B A trick is to remember that the arrow is always pointing at the smaller number.
16th Sep 2022, 5:23 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Kind of. Pay attention to your spelling. You have "scores" and "scrore" there, that won't work. Also, for the task, do you need to output the score or just the result? If it's just the result, remove the last line document.write("score");
16th Sep 2022, 6:14 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Almost there! You're doing great. var score = parseInt(readLine(), 10) /* 88 and above => excellent 40-87 => good 0-39 => fail */ // your code goes here if (score >=88){ console.log ("excellent"); } else if (score <= 87){ console. log ("good"); } else if(score >= 40){ console.log("good"); } else{ console.log ("fail"); } Should there really be 2 options for good? Maybe you mean it as one else if condition else if(score >= 40 && score <= 87) And you can remove those 2 from your code.
16th Sep 2022, 6:36 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
var score = parseInt(readLine(), 10) /* 88 and above => excellent 40-87 => good 0-39 => fail */ // your code goes here if (score >=88){ console.log ("excellent"); } else if(score >= 40 && score <= 87) { console.log("good"); } else{ console.log ("fail"); }
17th Sep 2022, 7:07 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Start with the greater than or less than symbol(>,<) then follow with the equal sign(=)
18th Sep 2022, 10:53 AM
ABDULKARIM MOHAMED
ABDULKARIM MOHAMED - avatar
+ 1
You don't have to do that much, all you have to do is - var score = parseInt(readLine(), 10) if(score >= 88) console.log("excellent"); else if(score >= 40 && score < 88) console.log("good"); else console.log("fail"); because if score is greater than or = to 88, you need to write excellent. If greater than or = to 40 and less than 88 you need to output good else if it is less than forty then you 100% fail
18th Sep 2022, 2:08 PM
MrBeast
MrBeast - avatar
0
Javascript
16th Sep 2022, 4:48 PM
Emmanuel Pena
0
You mean switch it up ?
16th Sep 2022, 5:07 PM
Emmanuel Pena
0
ar score = parseInt(readLine(), 10) /* 88 and above => excellent 40-87 => good 0-39 => fail */ // your code goes here if (scores >=88){ console.log ("excellent"); } else if (scrore <= 87){ Like this ?? console. log ("good");{ } }else{ console.log ("fail"); else if(score >= 40) console.log("good"); }else{ console.log ("fail"); document.write ("score") }
16th Sep 2022, 5:41 PM
Emmanuel Pena
0
var score = parseInt(readLine(), 10) /* 88 and above => excellent 40-87 => good 0-39 => fail */ // your code goes here if (score >=88){ console.log ("excellent"); } else if (score <= 87){ console. log ("good");{ } }else{ console.log ("fail"); else if(score >= 40) console.log("good"); }else{ console.log ("fail"); } Better ?
16th Sep 2022, 6:21 PM
Emmanuel Pena
0
var score = parseInt(readLine(), 10) /* 88 and above => excellent 40-87 => good 0-39 => fail */ // your code goes here if (score >=88){ console.log ("excellent"); } else if (score <= 87){ I tried this way but still console. log ("good");{ } }else{ ; else if(score >= 40 && score <=87){ }else{ console.log ("fail"); }
16th Sep 2022, 11:43 PM
Emmanuel Pena
0
Time wii ther
18th Sep 2022, 4:31 PM
yaswanthreddy