JSFiddle - React, Tailwind, and code Playground

by lavisha99

JavaScript

function Book (ID, title, name, genre, borrower) {
	this.ID = ID;
  this.title = title; 
  this.name = name; 
  this.genre = genre; 
  this.borrower = borrower; 
  let borrowUpdate = function (borrowedBook) {
  	this.borrower.push(update)
    }
}

let book01 = new Book (123456, 'This Is Going To Hurt', 'Adam Kay', ['comedy', 'drama']); 
let book02 = new Book (234567, 'Kingdom of Ash', 'Sarah Maas', ['fantasy', 'adventure', 'romance']); 
let book03 = new Book (345678, 'The Travelling Cat Novels', 'Hiro Arikawa', ['action', 'adventure']); 
let book04 = new Book (456789, 'The Barefoot Investor', 'Scott Pape', ['mystery', 'war', 'action']); 
let book05 = new Book (567890, 'Wonky Donkey', 'Craig Smith', ['comics']); 

/*
#3.2 Create a constructor for member objects. A library member has:
- ID, name, email, and contact phone.
*/
function Member (ID, name, email, contactPh) {
	this.ID = ID; 
  this.name = name; 
  this.email = email; 
  this.contactPh = contactPh;
}

let member01 = new Member (14, 'Kate', '[email protected]', 02103485177);
let member02 = new Member (9, 'Sam', '[email protected]', 02153372856);
let member03 = new Member (48, 'Iris', '[email protected]', 02216112846);
/*
#3.3 Create a constructor for creating a library object.
- The library has a name and address
- A list of books which is a collection of book objects.
- A list of members which is a list of member objects
*/ 
function Library (name, address) {
	this.name = name; 
  this.address = address; 
  this.bookCollection = []; 
  this.addBook = function (book) {
  	this.bookCollection.push(book);
    }
  this.members = [];
  this.addSubscriber = function (member) {
  	this.members.push(member);
 		}
  this.borrowedBook = []; 
  this.borrowBook = function (bookID, memberID) {
     this.borrowedBook.push(bookID)
     this.borrowedBook.push(memberID)
      return this.borrowedBook;
  }
 
}

/*
Using the library constructor, create a libray object with fictional information. Intiallly, the...