debugging statements that i needn't remove
This commit is contained in:
13
main.mjs
13
main.mjs
@@ -1,4 +1,7 @@
|
||||
import { argv } from 'node:process';
|
||||
import { env } from 'node:process';
|
||||
|
||||
const DEBUG = Boolean(env.DEBUG);
|
||||
|
||||
const grades = [
|
||||
{
|
||||
@@ -31,13 +34,13 @@ function getGrade(mark){
|
||||
if (typeof(mark) != 'number')
|
||||
for (let i=0;i<=grades.length-1;i++){
|
||||
const {max} = grades[i]
|
||||
console.log({i,max})
|
||||
printdebug({i,max})
|
||||
|
||||
if (max > mark) continue
|
||||
|
||||
for (let j=i;j>0;j--) {
|
||||
const {min,grade} = grades[j]
|
||||
console.log({j,min})
|
||||
printdebug({j,min})
|
||||
if (mark < min) continue
|
||||
return grade
|
||||
}
|
||||
@@ -50,3 +53,9 @@ function getGrade(mark){
|
||||
|
||||
const grade = getGrade(argv[2])
|
||||
console.log(grade)
|
||||
|
||||
function printdebug(text) {
|
||||
if (DEBUG) {
|
||||
console.error('DEBUG:',text)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user