We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b6e236f commit b8b977bCopy full SHA for b8b977b
debugging/book-library/script.js
@@ -1,10 +1,13 @@
1
let myLibrary = [];
2
3
window.addEventListener("load", function (e) {
4
- populateStorage();
+if (localStorage.getItem("myLibrary")) {
5
+ myLibrary = JSON.parse(localStorage.getItem("myLibrary"));
6
+ } else {
7
+ populateStorage();
8
+ }
9
render();
10
});
-
11
function populateStorage() {
12
if (myLibrary.length == 0) {
13
let book1 = new Book("Robinson Crusoe", "Daniel Defoe", "252", true);
0 commit comments