title: Stringify a string or null?
body: <p>I'm storing data as JSON objects in <code>localStorage</code>, because sometimes it can be an array, and I can just store values there.</p>
  
  <p>I have a key, where the value can be an array, or null. <code>JSON.stringify()</code> to set, and <code>JSON.parse()</code> to get works perfect.</p>
  
  <p>But I have a key where the value can be a string, or null. It causes problems. If I don't stringify and parse it, it stores <code>null</code> as <code>"null"</code>, which is a truthy value.</p>
  
  <p>If I do, it throws error when the value is originally a string. As I see, if I try to stringify a string, nothing happens, that's why.</p>
  
  <p>Of course I could use <code>==</code> (equal value) as comparison, and to not stringify and parse to solve the problem, but I'm looking for something more elegant.</p>
  
  <p>Any ideas?</p>