i have the following loops that goes through an array.\[code\]for(var j=0; j<10;j++) { for(var k=0; k<10; k++) { if(final[k]==ya[j]){ final[k].changeRankScore((ya[j].score + final[k].score)/2); }else{ } }}\[/code\]There are two array with 10 elements. I am checking if there is a duplicate element which is found in final. If yes, change the score of final of the duplicate element and do not add it to final. If no, we can add the element to final. One of the possible ways i thought of doing it was, to tag the element to add to the array later. Is there a better way of doing this?