-
-
Save parzibyte/82550a28882fc741f774cc7d69e692ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const funcionaLocalStorage = () => { | |
// Si no existe el objeto, pues no hay soporte | |
if(!window.localStorage) return false; | |
// Ahora intentamos insertar y eliminar | |
try{ | |
let id = "un_id_que_no_debe_repetirse"; | |
localStorage.setItem(id, "Soy un valor"); | |
localStorage.removeItem(id); | |
return true; | |
}catch(e){ | |
// Está lleno, está en modo privado, o cualquier cosa | |
console.log(e); | |
return false; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment