You're masking the global localstorage object. Line 6 will always through as you are doing `undefined.setItem`