function score_to_grade(score1) {  var score = 100 - score1;  if (score == 100)    return 'A+';  else if (score > 93)    return 'A';  else if (score > 87)    return 'A-';  else if (score > 81)    return 'B+';  else if (score > 69 )    return 'B';  else if (score > 63 )    return 'B-';  else if (score > 56 )    return 'C+';  else if (score > 44 )    return 'C';  else if (score > 38 )    return 'C-';  else if (score > 32 )    return 'D+';  else if (score > 19 )    return 'D';  else if (score == 0 )    return 'F';  else    return 'D-';}
Mapping a score to a string
javascript
function score_to_grade(pointsLost) {  // A more meaningful name to what's subtracted from the total  var score = 100 - pointsLost  // A map of grade to score in at least basis. Examples, an A is at least 93.  // You can easily add and remove mappings here  var map = [    ['A+', 100],    ['A', 93],    ['A-', 87],    ['B+', 81],    ['B', 69],    ['B-', 63],    ['C+', 56],    ['C', 44],    ['C-', 38],    ['D+', 32],    ['D', 19],    ['D-', 1],    ['F', 0]  ]  // Loop through the map and check if the score is at least a certain level  for (var i = 0; i < map.length; i++) {    if (score >= map[i][1]) return map[0];  }}