hey guys im having a slight probelm with the in array function (obviously my fault)...but what im trying to do is if a category isnt in the count array then for it to be added to array with a value of 1.
if category exists in array increase value by 1.
here is my code which keps just running this line below even if in array
- count[item.category] = 1;
- var count = [];
- // loop start
- if ($.inArray(item.category, count) === -1){
count[item.category] = 1;
}
else
{
count[item.category] = count[item.category] + 1;
}
- // loop end
any help would be greatly appreciated...thank you