Looks like if `window.localStorage` wasn't defined, then it would return `undefined`. But since you're checking before, if `window.localStorage` is not supported, it would return `null`.

Not sure I see the point of this code.