August 8th, 2013, 12:00 PM
How to take a number and give it a value.
I recently posted a question regarding how to find a percentage. I got my answer and now I am trying to find out how I would give the number a letter value. For example if a grade is 97 then the value is an A+ I'm just not sure how to go about it. Do I need to use an array? Any help would be appreciated.
August 8th, 2013, 01:34 PM
why can't you just write simple conditional logic like
Adjust the number of conditionals and the integer comparisons to suit your needs
var letterval = 'F'; // you fail by default, like in life
if (numberval > 95) letterval = 'A+';
else if (numberval > 90) letterval = 'A';
else if (numberval > 80) letterval = 'B';
else if blah blah blah