Let's say I have an array
var array = ["A", "A", "A", "B", "B", "A", "C", "B", "C"];
And I want to do a check, and get true if there are 4 identical elements "A"
If I use array.includes("A"), then it looks for only one such among all and in any case returns true, but I need when there are exactly 4 such elements
Or let's say in the same array I want to find 3 elements "B" and 2 elements "C", and return true only if there are as many of them as I'm looking for, if less, then return false
How can I do this?