I have:
myArray = [\"ABAB\", \"ABAB\", \"ABAB\", \"CDCD\", \"EFEF\", \"EFEF\"]
I need to count by occurrences and sort by highest count. This w
see console in firefox to see the resulting object
http://jsfiddle.net/4dqeK/1/
myArray = ["ABAB", "ABAB", "ABAB", "CDCD", "EFEF", "EFEF"];
container={};
for(var i=0; i < myArray.length;i++){
var el=myArray[i];
if( el in container){
container[el].push(el);
}
else{
container[el]=[];
container[el].push(el);
}
}
console.log(container);