JSFiddle - React, Tailwind, and code Playground
JavaScript
var images =["Cat.png", "Cock.png","Dog.png","Parrot.png","Penguin.png","Rabbit.png","Parrot.png"];
var counts = [];
var keys = [];
for (i = 0; i < images.length; i++){
if (!counts[images[i]]) {
counts[images[i]] = 0;
keys.push(images[i]);
}
counts[images[i]]++;
}
for (i = 0; i < keys.length; i++) alert(keys[i] + " : " + counts[keys[i]]);