Ensure scores are rounded to a single decimal point and update all integer values with .0
, except for 10
and 0
.
For example:
0.972 should be 0.9
2.83 should be 2.8
All integer scores will be updated as:
0
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
10
I have used regular expressions to handle the single digit after the decimal point:
parseFloat(pillarScore.match(/^-?\d*(?:\.\d{0,1})?/)[0]);
However, I am now working on obtaining the correct updated integer part instead of returning numbers like 1, 2, 3, etc.