Answers for "jquery localstorage delete item"

12

javascript localStorage clear items

localStorage.clear();//this clears the localStorage completely
Posted by: Guest on April-01-2020
0

local storage remove multiple items

//You could just put the keys to remove in an array and loop over them:

let keysToRemove = ["summaryForm", "projectForm"];

for (key of keysToRemove) {
    localStorage.removeItem(key);
}
//Using a full loop, or, using forEach:

keysToRemove.forEach(k =>
    localStorage.removeItem(k))

//Or use localStorage.clear() if you want to just clear everything.
Posted by: Guest on July-22-2020

Code answers related to "jquery localstorage delete item"

Code answers related to "Javascript"

Browse Popular Code Answers by Language