I want to write a rate system (similar to imdb movie rate), result maximum is 10, It's mean output can be a number between 0 to 10. and should show like this (2/10)
User can rate from, 1 to 5 (starts), each user allowed for once.
So consider, this array is all users rates.
let rate = ['4', '5', '1', '2', '5', '5', '2', '1', '3', '3', '4']; // all users rates
let result = 0;
for (i = 0; rate.length > i; i++) {
result += parseInt(rate[i]);
}
let av = result / 10;
It's working good, but the problem is, this output never reach to big rate, like 9 or 10. So I should make a target, right?, my ceil target is 1250, it's mean if all users rate total is 1250, user should get rate 10/10.
let av = 1250 / 10;
But this return 125 ofcourse.
Target: show all user rate like this, 5/10 or 7/10 like imdb rate.