Last active
March 2, 2019 14:00
-
-
Save haru01/25548384d5ad7cc7eb3e692ea652071b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| @@ -3,8 +3,5 @@ function generateReadedReport(readedList, recommendList) { | |
| report += '-----\n'; | |
| - let totalPoint = 0; | |
| - for (let readedBook of readedList.books) { | |
| - totalPoint += point(readedBook); | |
| - } | |
| + let totalPoint = total(); | |
| for (let readedBook of readedList.books) { | |
| @@ -18,4 +15,12 @@ function generateReadedReport(readedList, recommendList) { | |
| return report; | |
| + function total() { | |
| + let totalPoint = 0; | |
| + for (let readedBook of readedList.books) { | |
| + totalPoint += point(readedBook); | |
| + } | |
| + return totalPoint; | |
| + } | |
| + |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment