var countArr = [1,2,3,4,5,6,3,4,3,3,7,8,9,32,1,11,2,3,3,3]; var res = {}; var maxnum=0; var max; function getRepeat(arr){ for (var i = 0; i < arr.length; i++) { if(!res[arr[i]]){ res[arr[i]] = 1; }else{ res[arr[i]] ++; } }; var keys = Object.keys(res