var list = [["27","2.22"],["27","0.0025"],["41","0.003"]]; var results = {}; list.forEach(function(item){ var id = item[0]; var value = parseFloat(item[1]); if(results[id]==null){ value=value; }else{ value=value+results[id]; } results[id]=value; }) alert(JSON.stringify(results))