I have some array of objects and in that few data. My input is like :
My actual code is :
buildcount: function(store2){
var datacount = store2.data.items;
for(var i=0; i<datacount.length; i++){
var x = datacount[i].data
},
Here from store I am hgetting x which is array of object and each object have
obj{
STU: "Study1", SUB: "Subject1", EXL: "Yes"}
}
Object {STU: "Study1", SUB: "Subject1", EXL: "Yes"}
Object {STU: "Study1", SUB: "Subject1", EXL: "Yes"}
Object {STU: "Study2", SUB: "Subject1", EXL: "Yes"}
Object {STU: "Study3", SUB: "Subject1", EXL: "Yes"}
Object {STU: "Study1", SUB: "Subject1", EXL: "Yes"}
Object {STU: "Study3", SUB: "Subject1", EXL: "Yes"}
Object {STU: "Study3", SUB: "Subject1", EXL: "Yes"}
Object {STU: "Study2", SUB: "Subject1", EXL: "Yes"}
I want to count all the unique element and store in array with count. In javascript.
Output : object {"Study1 : 3", "Study2" : 2, "Study3":4}
object {"Study1 : 3", "Study2" : 2, "Study3":3}