+ 4

Why isn't this working?

var score = prompt("Enter achieved score out of max. 100"); var grade = (score <50) ? "Failed":(score <60) ? "2":(score <70) ? "3":(score <80) ? "4":(score <90) ? "5":(score >90) ? "5+"; document.write("grade");

22nd Dec 2017, 10:01 AM
Mark Pozsar
Mark Pozsar - avatar
3 odpowiedzi
+ 6
var score = prompt("Enter achieved score out of max. 100"); var grade = score < 50 ? "Failed" : score < 60 ? "2" : score < 70 ? "3" : score < 80 ? "4" : score < 90 ? "5" : "5+"; // You don't need '(score >90) ?' here document.write(grade); // remove quotes from grade
22nd Dec 2017, 10:46 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
thx dawg
23rd Dec 2017, 7:43 AM
Mark Pozsar
Mark Pozsar - avatar
0
thanks at list something that helps
29th Dec 2017, 7:09 AM
Nhlanhla Ngwenya
Nhlanhla Ngwenya - avatar