This line
item = JSON.parse(localStorage["item"]);
caused an error in my console showing Uncaught SyntaxError: Unexpected end of input when my localstorage has no value? How do I resolve this issue? I know that empty string is not a valid json.
localStorage["item"] !== "" ? JSON.parse(localStorage["item"]);correct?