I have a JSON object (stringified) getResponse["taskData"]
like this as an example:
[
{title: "123456", startOn: "30-4-2019-18-0", endOn: "30-4-2019-19-0"},
{title: "123456", startOn: "30-4-2019-18-0", endOn: "30-4-2019-19-0"},
{title: "qwerty", startOn: "1-5-2019-16-30", endOn: "1-5-2019-19-0"},
{title: "asdfgh", startOn: "1-5-2019-16-30", endOn: "1-5-2019-19-0"},
{title: "zxcvbn", startOn: "2-5-2019-9-0", endOn: "2-5-2019-11-0"}
]
What I need is to know how many duplicates of startOn values on different levels of the multidimensional object.
For instance, getting 30-4-2019-18-0 (2), 1-5-2019-16-30 (2)
as a result would be useful for me. Or, getting index integers of corresponding duplicates would also be helpful.
I've been trying to achieve such function using this:
var countSameStart = {};
getResponse["taskData"].forEach(function (x) {
countSameStart[x] = ( countSameStart[x] || 0 ) + 1;
});
But, then I figured out that this function was unable to access different levels of the object and compare those values. Moreover, I couldn't wrap my mind around it.
I appreciate any constructive answers as code or recommendation.