Suppose I have this data
| Name | Mark |
|---|---|
| John | 76 |
| Jack | 55 |
| Dani | 90 |
and for the grade
| Marks | Grade |
|---|---|
| 100-80 | A |
| 79 - 60 | B |
| 59 - 40 | C |
suppose i declare the script as
let data = [
[John, 76],
[Jack, 55],
[Dani, 90]
];
The program should assign the grade with the corresponding mark, how do I sort the grade since we know we cant change the index for mark as usual because each mark assign to different student? The output should display all data in descending order as
| Name | Mark | Grade |
|---|---|---|
| Dani | 90 | A |
| John | 76 | B |
| Jack | 55 | C |