Periksa apakah penyimpanan lokal digunakan atau kosong

if (localStorage.length > 0){
    //Items are stored in local storage
}else{
    //Local storage is empty
}
Zany Zebra