I have the following code which works perfectly, but I'm calling the getItem
function twice, which seems unnecessary. How can I tidy it up?
if(localStorage.getItem("preferences") == null {
//show set preferences page
} else {
var preferences = localStorage.getItem("preferences");
//do stuff
}