Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LibraryCollection{
- constructor(capacity){
- this.capacity=capacity;
- this.books=[];
- }
- addBook (bookName, bookAuthor){
- for (let i = 0; i < this.books.length; i++) {
- if( this.books[i] == null){
- throw new Error("Not enough space in the collection.")
- }else{
- let book={
- bookName:bookName,
- bookAuthor:bookAuthor,
- payed: false,
- }
- this.books.push(book)
- return "The {bookName}, with an author {bookAuthor}, collect.";
- }
- }
- }
- payBook( bookName ) {
- if(!this.books.some(x => x.bookName == bookName)){
- throw new Error(`${bookName} is not in the collection.`)
- }
- if (this.books.some(x => x.payed=)) {
- }
- }
- removeBook(bookName) {
- }
- getStatistics(bookAuthor){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment