JSFiddle - React, Tailwind, and code Playground

JavaScript

var images =["Cat.png", "Cock.png","Dog.png","Parrot.png","Penguin.png",
             "Rabbit.png","Parrot.png"];

var count = {};
for (var i=images.length; i-->0;) {
   var key = images[i].split(".")[0]; // this makes 'Parrot' from 'Parrot.png'
   if (count[key]) count[key]++;
   else count[key] = 1;
}

for (var key in count) {
 alert('there are ' + count[key] + ' ' + key);   
}