I have an array for example like this {John, John, John, Maria, Peter, Peter, Maria, Anna, Anna, Maria, Maria, Peter} I need to get result like 1 -> 3 2 -> 1 3 -> 2 4 -> 1 5 -> 2 6 -> 2 7 -> 1 Answer I group the names, then I count them.
Tag: equals
How to determine equality for two JavaScript objects?
A strict equality operator will tell you if two object types are equal. However, is there a way to tell if two objects are equal, much like the hash code value in Java? Stack Overflow question Is there any kind of hashCode function in JavaScript? is similar to this question, but requires a more academic answer. The scenario above demonstrates