I have an array with domain names without www in JavaScript. This array may contain duplicate records. I want to find all unique domains and their occurrence counts. Plz Help.
Here is the current code
exports.findUniqueDomains = function(uri_arr){
uri_arr.forEach(function(elem, index, arr){
arr[index] = elem.split('.')
.slice(-2)
.join('.');
});
return uri_arr.filter (function (v, i, a) { return a.indexOf (v) == i });
};