Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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.
Comment

PREVIOUS NEXT
Code Example
Javascript :: nodejs aws s3 stream upload 
Javascript :: datepicker strart with monday 
Javascript :: chrome add a bookmark that appends to current url 
Javascript :: jquery select2 how to make dont close after select 
Javascript :: npm ERR! code EJSONPARSE 
Javascript :: jquery table row count 
Javascript :: javascript random numbers 
Javascript :: moment js current date without format 
Javascript :: javascript absolute path 
Javascript :: jquery noconflict 
Javascript :: js string have number js 
Javascript :: how to remove all child elements in javascript 
Javascript :: js convert to fraction 
Javascript :: deploy react js heroku 
Javascript :: convert string in hh:mm am/pm to date js 
Javascript :: xmlhttprequest error handling 
Javascript :: disable button in swal popup 
Javascript :: jquery ajax on fail 
Javascript :: join array of object name javascript 
Javascript :: how to disable keyboard calender input in material ui datepicker reactjs 
Javascript :: count number of word in javascript 
Javascript :: parent of heap node 
Javascript :: vite.config.js 
Javascript :: insert new object values 
Javascript :: quine 
Javascript :: return elemnt from array 
Javascript :: Object.hasOwnProperty.call 
Javascript :: convert number to word j 
Javascript :: Take a Ten Minute Walk js 
Javascript :: if checkbox checked jquery value 1 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =