const btnFilters = document.querySelectorAll('.btn')
btnFilters.forEach(btn => filterBook(btn));
function filterBook(btn){
btn.addEventListener('click', (e) => {
if (e.target.id === "btnOrdenarPorPreco"){
orderBooks()
}else {
const filtered = Books.filter((book)=> book.categoria === e.target.value)
createBooks(filtered)
}
})
}
function orderBooks() {
const ordened = Books.sort((a, b) => a.preco - b.preco);
createBooks(ordened)
}