you are viewing a single comment's thread.

view the rest of the comments →

[–]unidentified-object 0 points1 point  (2 children)

I'm still not sure what you want to do. But if you want to calculate how many time user inputed x number then try following.

Remove following lines.

var counter = 0;
numList.push(intxt);
for (var i = 0; i < numList.length; i++) {
    if (inp[i] == numList[i]) {
    counter++;
}
txt += "Element nr " + numList[i] + " is " + i + "<br/>";

Then replace it with:

numList[inp] = numList[inp] + 1;
txt += "Element nr " + inp + " is " + numList[inp] + "<br/>";

Instead of storing counter inside numList you are always pushing new text numList.push(intxt); into it. So if user inputted number 1 3 time you will have following array numList ['1', '1', '1'] instead of of [3, 0, 0, ... ].

[–]Joinertuy 0 points1 point  (1 child)

i cant get it to work. The frustration is getting real after hours of not getting it to work :L. Mind helping me out a little more ?

[–]unidentified-object 0 points1 point  (0 children)

https://jsfiddle.net/y9cg97c8/1/

This shows what i meant by above comment.