BUILDING A GRADE CALCULATOR USING JAVASCRIPT .
Hi, this article describes the building of a Grade calculator using JavaScript function, Multiple If statement and Return statement to calculate and display the score of a student and the Grade obtained, while also showing how string concatenation works using the addition operator (+).
Lets get started.
STEP 1: Define a function ( gradeCalculator), set it to a function (arguments - score and total) and f
{ Function body }
Step 2: We calculate the percentage, as shown in line 3
Step 3: We determine the letter grade to be assigned to different score ranges. We will do this by using multiple- IF- Statements as shown between line 6 and line 15
Step 4: We return a message showing the letter grade and the score obtained using Return statement and the use of Addition symbol (+) to join the strings as shown in line 17.
Step 5: We start making use of our function by calling gradeCalculator and using 80 as our score and 100 as the total . We display our result as shown by using console.log.
Code
Output
Yea! Our Grade Calculator is ready. Hope you enjoyed yourself ?.