If the input is a number (e.g) 78.
Now,
0 to 60, belongs to RANK C,
61 to 90, belongs to RANK B,
91 to 100, belongs to RANK A.
Then, if we can't directly to compare 78 and area. like if (61<num && num<90)
or switch case
or any conditional,it's not allowed!
how can we find the rank number 78 belongs to ?
Here is my solution
I now have a solution to the problem, I use the Array.
let recordMap = [60, 90, 100]
recordeMap.push(78)
recordMap.sort((a,b)=>a-b)
now, the array is [60, 78, 90, 100]
,
then I just need to know 78's index, recordMap.findIndex(e=>e==78)
I can to known 78 is RNAK B.
Is there a better solution?