+ 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") }
13 Answers
+ 2
Invert all the <= and >=
+ 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.
+ 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");
+ 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.
+ 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");
}
+ 1
Start with the greater than or less than symbol(>,<) then follow with the equal sign(=)
+ 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
0
Javascript
0
You mean switch it up ?
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")
}
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 ?
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");
}
0
Time wii ther