ВlocalStorage
only strings are stored. If you do thislocalStorage.setItem('token', false)
, then atlocalStorage.getItem('token')
you don't get''
, and the result of bringingfalse
to the line, i.e.'false'.
Howeverfalse !== ''
- is also true, because!==
comparison without type conversion.