Static Tools for JS please! DOJO please use them!

When browsing through the DOJO sourcecode I found this gem:

dojo.io.argsFromMap = function(map, encoding, last){
  var enc = /utf/i.test(encoding||"") ? encodeURIComponent : dojo.string.encodeAscii;
  var mapped = [];
  var control = new Object();
  for(var name in map){
    var domap = function(elt){
      var val = enc(name)+"="+enc(elt);
      mapped[(last == name) ? "push" : "unshift"](val);
    }
    if(!control[name]){
      var value = map[name];
      // FIXME: should be isArrayLike?
      if (dojo.lang.isArray(value)){
        dojo.lang.forEach(value, domap);
      }else{
        domap(value);
      }
    }
  }
  return mapped.join("&");
}

Not only is it disturbing to find FIXME tags in released code, but also to find method call magic with push and unshift, which is hard to read. But the best part is the control variable. It's declared, but as far as I can see it's read but never
written.

As DOJO does unit testing, this code shows that JUnit tests are not sufficient for quality assurance. What Javascript needs are static checker tools, either in the IDE (hopefully IDEA will find such bugs in the future as it does in Java) or as a standalone tool like PMD, FindBugs or Checkstyle.