marchetype / the-box-project

Code Bootcamp Project 1
MIT License
1 stars 1 forks source link

Failed to Load Resource #24

Closed zMag33z closed 1 year ago

zMag33z commented 1 year ago

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

zMag33z commented 1 year ago

Seems good. Confliction on my end. Old project resource file in localstorage not compatible.