title: If statement not returning as supposed
body: <p>I might seem really dumb but this piece of code is really frustating me.</p>
  
  <pre><code>if(fs.exist(parametters[0])){
    fs.remove(parametters[0]);
    return "removed";
  }else{
    return "doesn't exist"
  }
  </code></pre>
  
  <p>The thing is, the <code>fs.remove()</code> is actually called but the function is returning <code>"doesnt't exist"</code>, Am I missing something?</p>
  
  <p>I'm not using nodejs, this is from one library i made, is asynchronously.
  It's not modifying the parametters but it does change the condition, might be that?</p>
  
  <p>Well I'm posting my <code>fs</code> object although I don't think this will change anything.</p>
  
  <pre><code> fs = {
          load: function() {
              if (localStorage[0] == undefined || localStorage[0] == "undefined" || localStorage[0] == "") {
                  localStorage[0] = JSON.stringify(fs.files);
              } else {
                  fs.files = JSON.parse(localStorage[0]);
              }
          },
          save: function() {
              localStorage[0] = JSON.stringify(fs.files);
          },
          files: [],
          newFile: function(name, content, overwrite) {
              if (overwrite == undefined)
                  overwrite = true;
              if (fs.exist(name) &amp;&amp; overwrite) {
                  fs.find(name).content = content;
                  fs.save();
              }
              if (!(fs.exist(name))) {
                  fs.files.push({
                      name: name,
                      content: content
                  });
                  fs.save();
              }
          },
          exist: function(fileName) {
              for (var i = 0; i &lt; fs.files.length; i++) {
                  if (fs.files[i].name == fileName)
                      return true;
              }
              return false;
          },
          find: function(fileName) {
              for (var i = 0; i &lt; fs.files.length; i++) {
                  if (fs.files[i].name == fileName)
                      return fs.files[i];
              }
              return false;
          },
          format: function() {
              fs.files = [];
              localStorage[0] = undefined;
          },
          write: function(name, content, overwrite) {
              if (overwrite == undefined)
                  overwrite = true;
              if (fs.exist(name) &amp;&amp; overwrite) {
                  fs.find(name).content = content;
                  fs.save();
              }
              if (!(fs.exist(name))) {
                  fs.files.push({
                      name: name,
                      content: content
                  });
                  fs.save();
              }
          },
          remove: function(file) {
              var arrToreturn = [];
              for (var i = 0; i &lt; fs.files.length; i++) {
                  if (fs.files[i].name != file)
                      arrToreturn.push(fs.files[i]);
              }
              fs.files = arrToreturn;
              fs.save();
              return arrToreturn;
          }
      }
  </code></pre>
  
  <p>Resolved - 
  After a few days of inspecting the code I found the bug where the function was called twice, the amount of code was really huge so it took me a while.</p>