crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>Store and retrieve data from local storage.</h2> <p id="demo"></p> <script> /* Storing data: */ const myObj = {name: "Ahmed", age: 31, city: "Cairo"}; const myJSON = JSON.stringify(myObj); localStorage.setItem("testJSON", myJSON); /* Retrieving data: */ let text = localStorage.getItem("testJSON"); let obj = JSON.parse(text); document.getElementById("demo").innerHTML = obj.name; </script> </body> </html>
Store and retrieve data from local storage.