Skip to content

Instantly share code, notes, and snippets.

@haru01
Created March 3, 2019 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haru01/55ad98c73b1ba668786ce41142547b5d to your computer and use it in GitHub Desktop.
Save haru01/55ad98c73b1ba668786ce41142547b5d to your computer and use it in GitHub Desktop.
@@ -12,9 +12,6 @@ function generateReadedReport(readedList, recommendList) {
function total() {
- let totalPoint = 0;
- for (let readedBook of readedList.books) {
- totalPoint += point(readedBook);
- }
- return totalPoint;
+ return readedList.books
+ .reduce((total, book) => total + point(book), 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment