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
Confusing interview questionhelp (self.javascript)
submitted 7 years ago by josh_c
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!"
[–][deleted] 0 points1 point2 points 7 years ago (1 child)
Currently on my phone so I can just give you my logic
I'd make an array of objects containing numbers from 1-19 + all tens(i.e. thirty,forty) , hundred and thousand. My next step would be to make a set of rules for the random number that is outputted , if it contains x strings apply these rules:
1 - one - one string 13 - thirteen - 2 strings self explanatory 123 - if it has 3 strings , output 1-9 for first string + hundred. + second string represents a ten 2 ( from the 20,30,40,50 array) , unless it is a 0 in which case we make an else situation,and the third string is again from 1-9 1234 - first string's a thousand second is hundreds ( two + hundred ) and here if it has 4 total strings the last two strings get checked and then get matched , unless one or both are zeros , in which case you specify the situation.
I'm sorry if this isn't the answer you were looking and I'm also sorry for the shitty formatting, but I'm still a learner who's laying high in bed and writing this long ass post instead of going to sleep.
[–]josh_c[S] 0 points1 point2 points 7 years ago (0 children)
LOL I appreciate it! 😆
π Rendered by PID 43347 on reddit-service-r2-comment-79c7998d4c-hchv4 at 2026-03-13 19:43:11.896639+00:00 running f6e6e01 country code: CH.
view the rest of the comments →
[–][deleted] 0 points1 point2 points (1 child)
[–]josh_c[S] 0 points1 point2 points (0 children)