Counting ratings on a page to display

Is there code to count ratings from a review repeater, and then display that total number of ratings on the ratingsdisplay? If possible, could you also find the average from just counting the already submitted ratings from reviews? Thank you!

Something like this…

let DATA  = results.items

avgRating = DATA2[0].avg
totalRating = DATA2[0].totalRatings;                  numRating = DATA2[0].numRatings;                    

$w('#RATINGdisplay').numRatings = ???
$w('#RATINGdisplay').rating = ???

No good ----> INPUT = no good ----> OUTPUT !