Ad
Code
Diff
  • function getGrade (s1, s2, s3) {
      let avg = (s1 + s2 + s3) / 3;
      return avg>= 90
      ? "A"
      : avg>=80
      ? "B"
      : avg>=70
      ? "C"
      : avg>=60
      ? "D"
      : "F"
    }
    • function getGrade (s1, s2, s3) {
    • let avg = (s1 + s2 + s3) / 3;
    • if (avg >= 90) {
    • return "A"
    • }
    • if (avg >= 80) {
    • return "B"
    • }
    • if (avg >= 70) {
    • return "C"
    • }
    • if (avg >= 60) {
    • return "D"
    • }
    • return "F";
    • return avg>= 90
    • ? "A"
    • : avg>=80
    • ? "B"
    • : avg>=70
    • ? "C"
    • : avg>=60
    • ? "D"
    • : "F"
    • }