% var totalCount = 0; for(var i=maximumGrade;i>=1;i--){ totalCount+= result.RatingDetails[i]; } if(totalCount == 0){ totalCount = 1; } %> <% for(var i=maximumGrade;i>=1;i--){ %>