浏览代码

Modify grade-calc to use const

Signed-off-by: Michael Tang <michael.h.tang@gmail.com>
Michael Tang 5 年之前
父节点
当前提交
8c78be2b8b
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      grade-calc.js

+ 3 - 3
grade-calc.js

@@ -3,8 +3,8 @@
 // A 90-100, B 80-89, C 70-79, D 60-69, F 0-59
 
 
-let gradeCalc = function (studentScore, totalPossibleScore) {
-    let grade = (studentScore / totalPossibleScore) * 100
+const gradeCalc = function (studentScore, totalPossibleScore) {
+    const grade = (studentScore / totalPossibleScore) * 100
     let letterGrade = ''
     if (grade <= 100 && grade >= 90) {
         letterGrade = 'A'
@@ -20,6 +20,6 @@ let gradeCalc = function (studentScore, totalPossibleScore) {
     return `You got a ${letterGrade} (${grade}%)`
 }
 
-let result = gradeCalc(45.0,100.0)
+const result = gradeCalc(45.0,100.0)
 
 console.log(result)