title: Not getting same type from localStorage as the saved variable had?
body: <p>I wrote a simple task list. The JavaScript code is below, the important part is about localStorage. What I made so far is this: <a href="https://jsbin.com/cobozunova/edit?html,js,output" rel="nofollow">JSBin</a></p>
  
  <p>What i want to achieve is that when i reload the page, the setting if the entries should be removed immediately (if the checkbox next to the textfield is checked or not), is saved and restored from the last visit. </p>
  
  <p>Currently when I first load the page I need to uncheck and then check the checkbox again in order to make it work as I want it...</p>
  
  <p>Here is my JavaScript/jQuery code:</p>
  
  <pre><code>var anzahl = 0;
  var autoremove = true;
  var autoremove_backup = localStorage.getItem("autoremove");
  console.log(localStorage.getItem("autoremove"));
  
  $(document).ready(function() {
    if(autoremove_backup===false){
      $("#autoremove").prop( "checked", false);
    }
    else if (autoremove_backup===true){
      $("#autoremove").prop( "checked", true);
    }
    autoremove = autoremove_backup;
    setInterval(entry, 2000);
    $("button").on('click', function() {
      if(this.id=="add"){
        var r = $('&lt;div id="'+ "div"+String(anzahl) +'"&gt;&lt;input type="checkbox" id="'+String(anzahl)+'"&gt;' + '&lt;label for="'+ String(anzahl)+'" id="'+ "label" +String(anzahl)+'"&gt;' + $("#task").val() + '&lt;/label&gt;&lt;br&gt;&lt;/div&gt;');
        $("#var").append(r);
        anzahl = anzahl +1;
      }
    });
    $('input[type=checkbox]').change(
      function(){
        if (this.checked) {
          if(String(this.id)==="autoremove"){
            autoremove=true;
            saveAutoremove(autoremove);
          }
        }
        else {
          if(String(this.id)==="autoremove"){
            autoremove=false;
            saveAutoremove(autoremove);
          }
        }
      });
  
  });
  
  function entry(){
  if(autoremove===true){
    $('#var input:checked').each(function() {
      $("#div"+String(this.id)).remove();
  });
  }
  }
  
  
  function saveAutoremove(input){
    localStorage.setItem("autoremove", input);
  }
  </code></pre>