-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary.js
More file actions
52 lines (38 loc) · 1.23 KB
/
library.js
File metadata and controls
52 lines (38 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const myLibrary = [
{title:"The Hobbit",author:"J.R.R Tolkien",pages:293,read:"not yet read"},
{title:"The Silmarillion",author:"J.R.R Tolkien",pages:365,read:"not yet read"},
{title:"Angels and Demons",author:"Dan Brown",pages:448,read:"read"}
];
const body = document.querySelector("body");
const bookListContainer = document.querySelector("#bookList");
const modal = document.querySelector("#dialog1");
const closeButton = document.querySelector("#closeBtn");
function Book(title, author, pages, read){
this.title = title;
this.author = author;
this.pages = pages;
this.read = read;
this.info = function() {
const bookInfo = `${title} by ${author}. ${pages} pages, ${read}.`;
return bookInfo;
}
}
function addBookToLibrary(){
console.log(body);
modal.showModal();
}
function displayBooks(){
//bookListContainer.append()
for (var book of myLibrary){
console.log(`
Title:${book.title}\n
Author:${book.author}\n
Page Count:${book.pages}\n
Read Status:${book.read}\n
`)
}
}
function closeDialog(){
modal.close();
}
// const book1 = new Book("The Hobbit","J.R.R Tolkien",293,"not yet read");