-
-
Save parzibyte/4192b0c9a12feca013917e63be63a215 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
// Recuperar elementos | |
// No parsear porque lo queremos como cadena | |
let nombre = localStorage.getItem("nombre"); | |
console.log("Te llamas ", nombre); | |
// convertir a entero | |
let edad = parseInt(localStorage.getItem("edad")); | |
console.log("Tu edad es: ", edad); | |
// Convertir a booleano | |
let recibirNotificaciones = Boolean(localStorage.getItem("recibirNotificaciones")); | |
console.log("¿Quiere recibir notificaciones?", recibirNotificaciones); | |
// Y a objeto | |
let mascotaDecodificada = JSON.parse(localStorage.getItem("mascota")); | |
console.log("La mascota es: ", mascotaDecodificada); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment