This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
let myLibrary=[ {
author:"Bill Bryson",
title:"A Walk In The Woods",
pages:205,
read:"not read yet"
},
{
author:"Jerome K Jerome",
title:"Three Men In A Boat",
pages:205,
read:"read"
}
];
function Book(author,title,pages,read){
this.author=author;
this.title=title;
this.read=read;
this.pages=pages;
}
//function to add new book to array
function addBookToLibrary(author,title,pages,read){
let book = new Book(author,title,pages,read) Â
myLibrary.push(book);
}
//function to display books
const books = myLibrary
function displayBook(){
myLibrary.forEach((book)=>{
const list=document.querySelector('#book-list');
const row=document.createElement('tr');
row.innerHTML=`
  <td>${books.author}</td>
  <td>${books.title}</td>
  <td>${books.pages}</td>
  <td>${books.read}</td>
  <td><button>Delete</button></td>
  `
list.appendChild(row);
})
}
displayBook();
Subreddit
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/learnjavasc...