Conditionals
Conditionals
π¨βπΌ We're building a grade calculator for a school system. Based on a numeric
score, we need to determine the letter grade.
π¨ Open
. The starter sets
score to 85.- Create a
gradestring using anif/else if/elsechain:- 90 and above:
"A" - 80β89:
"B" - 70β79:
"C" - 60β69:
"D" - Below 60:
"F"
- 90 and above:
- Create
passedas a boolean that istruewhen the letter grade is C or above (that means grades"A","B", or"C") - Export
score,grade, andpassed
Required exports
score, grade, passedCompletion criteria (with score = 85)
scoreremains85gradeis"B"passedistrue
π° Check the highest ranges first so the first match wins.
π MDN - if...else