标签:validate return test UNC val bsp pre max ida
function validateStr(val){ let obj = {}; let maxNum = -1; let maxStr; for(let i=0;i<val.length;i++){ if(!obj[val[i]]){ obj[val[i]] = 1; if( obj[val[i]]>maxNum){ maxNum = obj[val[i]]; maxStr = val[i]; } }else{ obj[val[i]]++; if( obj[val[i]]>maxNum){ maxNum = obj[val[i]]; maxStr = val[i]; } } } return{ maxNum, maxStr } }
标签:validate return test UNC val bsp pre max ida
原文地址:https://www.cnblogs.com/huangmin1992/p/10152594.html