error is here.
function displayFavorites() {
let favImages = localStorage.getItem('saved-images');console.log(favImages);
// if (favImages === ''
favImages = JSON.parse(favImages);
Needs to have an if stating if no localstorage do something.
example for multiple images to be saved:
if(localStorage.getItem('saved-images') == null){
localStorage.setItem('saved-images', []);
}
if you use the above if statement, be sure to put literals around your array. (not quotations ' ' , " " ) (use literals )
clear your localStorage then refresh page to see error.
console error Failed to Load Resource.
error is here. function displayFavorites() { let favImages = localStorage.getItem('saved-images');console.log(favImages); // if (favImages === '' favImages = JSON.parse(favImages);
Needs to have an if stating if no localstorage do something.
example for multiple images to be saved: if(localStorage.getItem('saved-images') == null){ localStorage.setItem('saved-images',
[]
); }if you use the above if statement, be sure to put literals around your array. (not quotations ' ' , " " ) (use literals
)
clear your localStorage then refresh page to see error.
Crystal Ripple - zMaG33z