I need to clear all data i set into localStorage
. By this, I mean completely reset localStorage
to null
when users remove their accounts.
How can i do that with a simple function?
I tried this:
function clearLocalStorage(){
return localStorage= null;
}
But it doesn't work as expected.
localStorage.clear();
should work.