I am trying to push objects into my array. The problem is some objects are duplicated.
My codes are as following:
var obj = {
'obj1 {
'id':'1', 'title':'title 1'
},
'obj2 {
'id':'2', 'title':'title 2'
},
'obj3 {
'id':'3', 'title':'title 3'
}, //duplicated
'obj3 {
'id':'3', 'title':'title 3'
},
'obj4 {
'id':'4', 'title':'title 4'
}
// and many more..
}
var arr= [];
for (i in obj){
arr.push(obj[i])
}
I am not sure how to find out the duplicated obj and only push the unique objects into my arr
.
Can someone help me out? Thanks a lot!