I use the session storage to set a key that can take numeric values or null. I noticed that the field is stored as a string no matter what I put in. Is there a nice way to convert back my stored value to null ?
For instance, I want to do a check in my code as such:
if (!sessionStorage.getItem('key')) {
// do something
}
Whats the best way to make that check? The obvious way would be
if (!sessionStorage.getItem('key') !== "null") {
// do something
}
I am wondering if there's an alternative.