For example:
counter = {}
yourArray.forEach(function(obj) {
var key = JSON.stringify(obj)
counter[key] = (counter[key] || 0) + 1
})
Docs: Array.forEach, JSON.stringify.
More Related Contents:
- How to remove all duplicates from an array of objects?
- Counting the occurrences / frequency of array elements
- How to get the difference between two arrays of objects in JavaScript
- Converting a JS object to an array using jQuery
- Remove array element based on object property
- Why can I add named properties to an array as if it were an object?
- Most efficient way to convert an HTMLCollection to an Array
- Remove duplicate values from JS array [duplicate]
- Sum JavaScript object propertyA values with the same object propertyB in an array of objects
- Merge multiple objects inside the same array into one object [duplicate]
- How can I get the index of an object by its property in JavaScript?
- How to get objects value if its name contains dots?
- Why do empty JavaScript arrays evaluate to true in conditional structures?
- How do I remove an object from an array with JavaScript? [duplicate]
- Convert JavaScript array of 2 element arrays into object key value pairs
- Perform .join on value in array of objects
- Create a reset of javascript Array prototype when Array.prototype has been modified?
- break array of objects into separate arrays based on a property
- Remove duplicate values from an array of objects in javascript [duplicate]
- Deep comparison of objects/arrays [duplicate]
- Group by, and sum, and generate an object for each array in JavaScript
- Filtering array of objects by searching nested object properties
- traversing through JSON string to inner levels using recursive function
- Javascript pushing objects into array changes entire array
- How to remove duplicates from a two-dimensional array? [closed]
- Combining two arrays to form a javascript object
- How to group an array of objects based on multiple keys in Javascript?
- Best way to flatten JS object (keys and values) to a single depth array
- JS associative object with duplicate names
- How can I remove an element from a list, with lodash?