//OPCIÓN 1 function getGrade (s1, s2, s3) { avg = (s1+s2+s3)/3; if (avg < 60) return "F"; else if (avg < 70) return "D"; else if (avg < 80) return "C"; else if (avg < 90) return "B"; else return "A"; } //OPCIÓN 2 function getGrade(...scores) { let avg = scores.reduce((a, b) => a + b, 0) / scores.length; if (avg < 60) return "F"; else if (avg < 70) return "D"; else if (avg < 80) return "C"; else if (avg < 90) return "B"; else return "A";
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter