Created
July 31, 2019 08:06
-
-
Save jasongorman/7e25471fdc6a9e513d50e98b00706712 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
averageRating(){ | |
return this.sumOfRatings() | |
/this.reviews.length; | |
} | |
sumOfRatings() { | |
return this.reviews | |
.map((review) => review.rating) | |
.reduce((sum, rating) => sum + rating); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment