Compare commits
3 Commits
e863475b2d
...
3127d21afa
| Author | SHA1 | Date | |
|---|---|---|---|
|
3127d21afa
|
|||
|
6f7fc02d24
|
|||
|
300265bc3f
|
18
main.mjs
18
main.mjs
@@ -30,8 +30,18 @@ const grades = [
|
||||
}
|
||||
]
|
||||
|
||||
/**
|
||||
* Returns the grade corresponding to mark.
|
||||
*
|
||||
* @param {number} input The marks out of 100.
|
||||
* @return The corresponding grade of the marks.
|
||||
* @customfunction
|
||||
*/
|
||||
|
||||
function getGrade(mark){
|
||||
if (typeof(mark) != 'number')
|
||||
|
||||
if (isNaN(Number(mark))) return 'Ab'
|
||||
|
||||
for (let i=0;i<=grades.length-1;i++){
|
||||
const {max} = grades[i]
|
||||
printdebug({i,max})
|
||||
@@ -54,8 +64,4 @@ function getGrade(mark){
|
||||
const grade = getGrade(argv[2])
|
||||
console.log(grade)
|
||||
|
||||
function printdebug(text) {
|
||||
if (DEBUG) {
|
||||
console.error('DEBUG:',text)
|
||||
}
|
||||
}
|
||||
function printdebug(text){ if (DEBUG)console.error('DEBUG:',text) }
|
||||
|
||||
Reference in New Issue
Block a user