From 7a89d1a4c519677ad04d292f8c8d9160a6c7aceb Mon Sep 17 00:00:00 2001 From: Kyle B Date: Mon, 30 Dec 2024 15:44:02 -0500 Subject: [PATCH] add base functions to js file --- library-app/js/javascript.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/library-app/js/javascript.js b/library-app/js/javascript.js index e69de29..ee9d874 100644 --- a/library-app/js/javascript.js +++ b/library-app/js/javascript.js @@ -0,0 +1,21 @@ +const myLibrary = []; + +function Book(title, author, pages, read) { + this.title = title; + this.author = author; + this.pages = pages; + this.read = read + // this.info = function() { + // return `${this.title} by ${this.author}, ${this.pages}, ${this.read}` + // } +} + +function addBookToLibrary(title,author,pages,read) { + let newBook = new Book(title,author,pages,read) + myLibrary.push(newBook) +} + + +console.log(myLibrary) +addBookToLibrary("Test Book", "Kyle", "300", true) +console.log(myLibrary) \ No newline at end of file