// Check browser support if (typeof(Storage) !== "undefined") { // Store localStorage.setItem("lastname", "Smith"); // Retrieve document.getElementById("result").innerHTML =...











// Check browser support

if (typeof(Storage) !== "undefined") {

// Store

localStorage.setItem("lastname", "Smith");

// Retrieve

document.getElementById("result").innerHTML = localStorage.getItem("lastname");

} else {

document.getElementById("result").innerHTML = "Sorry, your browser does not support Web Storage...";

}






a) Create a variable called myObj and define it to have as its value the object of your choice.


b) Modify the setItem() call to be …setItem(“JSONstring”, _______) where the underlined portion contains a call to stringifymyObj. This will store your object as JSON text in the brower’s hidden local storage area in a virtual file called JSONstring.


c) Modify the getItem() call and add any code necessary to retrieve the JSON text, parse it back into an object, and print any value you like from the object.





May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here