Compare commits

..

3 Commits

Author SHA1 Message Date
3127d21afa compact code for unreadability 2024-08-26 12:41:15 +05:30
6f7fc02d24 return 'Ab' for non numeric inputs 2024-08-26 12:32:14 +05:30
300265bc3f add jsdoc 2024-08-26 12:23:11 +05:30

View File

@@ -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) }