distinct array
distinct array
hey guys...im trying to get a list of all categoryies from an array (below).
the result im trying to get is:
Footwear, Clothes
but not:
Footwear, Clothes, Footwear, Clothes
the array below could contain 100's or even 1000's of items so a foreach loop would be too slow to get the categories feature in the array.
is there a easy solution to get the results im after please...thank you
- var items = [{
"title": "Nike air MAX",
"distance": "5 Miles",
"end_timestamp": "2010-12-15 21:51:45",
"total_price": "18.00",
"condition": "Used",
"category": "Footwear",
"sub-category": "Trainers",
"location": "Middle East",
"buy_now" : "0"
}, {
"title": "Levis Jeans",
"distance": "5 Miles",
"end_timestamp": "2010-12-15 21:51:45",
"total_price": "38.00",
"condition": "New",
"category": "Clothes",
"sub-category": "Jeans",
"location": "United Kindgom",
"buy_now" : "1"
}, {
"title": "Gola Cheap Trainers",
"distance": "4 Miles",
"end_timestamp": "2012-11-15 21:51:45",
"total_price": "99.99",
"condition": "Broken",
"category": "Footwear",
"sub-category": "Trainers",
"location": "Europe",
"buy_now" : "0"
}, {
"title": "Desil Shirt",
"distance": "7 Miles",
"end_timestamp": "2000-12-15 21:51:45",
"total_price": "50.00",
"condition": "Used",
"category": "Clothes",
"sub-category": "Shirts",
"location": "Europe",
"buy_now" : "1"
}];