This is what I am trying to do,
// declare an array with 16 items, each with intial value = 0
var countMe = [
["00", 0],
["01", 0],
["02", 0],
["03", 0],
["10", 0],
["11", 0],
["12", 0],
["13", 0],
["20", 0],
["21", 0],
["22", 0],
["23", 0],
["30", 0],
["31", 0],
["32", 0],
["33", 0]
];
// calculate number of items for each array item by adding +1 to its previous value
$.each(dataFruits, function (index, item) {
if (item.weight > -1 && item.quantity > -1) {
countMe["" + item.weight + item.quantity, 1][1] = countMe["" + item.weight + item.quantity, 1][1] + 1;
}
});
// go through array and call method for each array item whose value is more then zero
for (var i = 0; i < 3; i++) {
for (var j = 0; j < 3; j++) {
if (countMe["" + i + j, 1][1] > 0) {
CreateText(countMe["" + i + j, 1][1], "black", 33, countMe["" + i + j, 0][0]);
}
}
}
Issues
I am not able to get value of array
I am able to update its value
It doesn't throw any errors, just doesn't give me any value.
"" + item.weight + item.quantity, 1comma syntax ?