for(item in mapCount1) { if(mapCount1[item] !== mapCount2[item]) return false }
JS中的for...in会判断对象原型链上的所有属性,如果只是考虑对象自己的属性可以参考:
for(item in mapCount1){
  if(mapCount1.hasOwnProperty(item)){
     if(mapCount1[item] !== mapCount2[item]) 
        return false;
  }
}