Skip to content

Instantly share code, notes, and snippets.

@haru01
Last active March 2, 2019 14:00
Show Gist options
  • Select an option

  • Save haru01/25548384d5ad7cc7eb3e692ea652071b to your computer and use it in GitHub Desktop.

Select an option

Save haru01/25548384d5ad7cc7eb3e692ea652071b to your computer and use it in GitHub Desktop.
@@ -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