Answer the question
In order to leave comments, you need to log in
How to calculate the average rating like in mongoDB, only in pure js?
I have a post:
post: {
title: "Future devops",
avgrating: 5,
ratingOne: 4
ratingTwo: 4
ratingThree: 4
ratingFour: 5
ratingFive: 4
}
commentsPost: [
{
name: "Dima",
ratingOne: 3,
ratingTwo: 2,
ratingThree: 2,
ratingFour: 5,
ratingFive: 2
},
{
name: "Dima",
ratingOne: 3,
ratingTwo: 2,
ratingThree: 2,
ratingFour: 5,
ratingFive: 2
},
{
name: "Dima",
ratingOne: 3,
ratingTwo: 2,
ratingThree: 2,
ratingFour: 5,
ratingFive: 2
},
{
name: "Dima",
ratingOne: 3,
ratingTwo: 2,
ratingThree: 2,
ratingFour: 5,
ratingFive: 2
},
{
name: "Dima",
ratingOne: 3,
ratingTwo: 2,
ratingThree: 2,
ratingFour: 5,
ratingFive: 2
},
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question