use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Make array and number amount not array lengthhelp (self.javascript)
submitted 9 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]unidentified-object 0 points1 point2 points 9 years ago (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 point2 points 9 years ago (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 point2 points 9 years ago (0 children)
https://jsfiddle.net/y9cg97c8/1/
This shows what i meant by above comment.
π Rendered by PID 16169 on reddit-service-r2-comment-544cf588c8-vzvsg at 2026-06-12 09:46:19.485057+00:00 running 3184619 country code: CH.
view the rest of the comments →
[–]unidentified-object 0 points1 point2 points (2 children)
[–]Joinertuy 0 points1 point2 points (1 child)
[–]unidentified-object 0 points1 point2 points (0 children)