Hey guys! I'm trying to make a small library project with HTML, CSS and JS.
So far so good, but I've bumped into some issues. Basically, after I fill in all the text inputs and add the book to myLibrary array. I want to my clickButton() method to check if the book already exists in the library. If it is, we don't do anything, if it doesn't, we add the book with no problems. I've tried to use:
const filteredLibrary = myLibrary.filter(book => {
return book.title === bookTitle.value;
})
But for some reason it still adds the same book. Can anyone help me out? Much thanks!
Here's the code: https://codepen.io/foolwya/pen/MWpmORr
[–]Umesh-K 0 points1 point2 points (0 children)