Hello, I am new to this forum but maybe you guys can help me
I have an array:
arrNums = 122379, 198702, 102884, 109231;
now this arrNums resets itself for every post on the page (there might be 4-5 posts on every page) and there might be repeating numbers in each of these posts. I need to write a 2d array myArray['num'] storing numbers and myArray['count'] storing count of each time the number has occured.
arrNums = 122379, 198702, 102884, 109231;
for (i=0; i<arrNums.length; i++){
for (j=0; j<myArray['num'].length; j++){
if (myArray['num'][j] == arrNums) // if this number already exists then increment count
myArray['num'] = arrNums; // otherwise set the new number
}
I know I am doing it completely wrong but i desperately need help! : )
I have an array:
arrNums = 122379, 198702, 102884, 109231;
now this arrNums resets itself for every post on the page (there might be 4-5 posts on every page) and there might be repeating numbers in each of these posts. I need to write a 2d array myArray['num'] storing numbers and myArray['count'] storing count of each time the number has occured.
arrNums = 122379, 198702, 102884, 109231;
for (i=0; i<arrNums.length; i++){
for (j=0; j<myArray['num'].length; j++){
if (myArray['num'][j] == arrNums) // if this number already exists then increment count
myArray['num'] = arrNums; // otherwise set the new number
}
I know I am doing it completely wrong but i desperately need help! : )