Showing
1 changed file
with
2 additions
and
1 deletions
| 1 | -function addPrice(amount) { | 1 | +function addPrice(amount) { |
| 2 | this.price = amount; | 2 | this.price = amount; |
| 3 | } | 3 | } |
| 4 | function book(title, author) { | 4 | function book(title, author) { |
| ... | @@ -13,6 +13,7 @@ console.log(bookList); | ... | @@ -13,6 +13,7 @@ console.log(bookList); |
| 13 | console.log("After Sorting"); | 13 | console.log("After Sorting"); |
| 14 | bookList.sort(sortBook); | 14 | bookList.sort(sortBook); |
| 15 | // sortBook 이라는 comparing function을 완성하시오. | 15 | // sortBook 이라는 comparing function을 완성하시오. |
| 16 | +// sortBook(a, b) { if (a > b) return 1; else if (a < b) return -1; else return 0; | ||
| 16 | // 1 순위 : title | 17 | // 1 순위 : title |
| 17 | // 2 순위 : author | 18 | // 2 순위 : author |
| 18 | console.log(bookList); | 19 | console.log(bookList); | ... | ... |
-
Please register or login to post a comment