add base functions to js file
This commit is contained in:
parent
5e22f41020
commit
7a89d1a4c5
1 changed files with 21 additions and 0 deletions
|
@ -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)
|
Loading…
Reference in a new issue