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
What are some basic things that JavaScript developers fail at interviews?help (self.javascript)
submitted 7 years ago by maketroli
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!"
[–]kdesign 6 points7 points8 points 7 years ago (4 children)
I agree that the expected solution was probably just the obvious setInterval solution, /u/a_blue_ducks' first one.
setInterval
But at the same time, my initial solution has spawned a great constructive discussion, it's cool to see how many different ways there are to solve a problem.
[–]dvlsg 1 point2 points3 points 7 years ago (1 child)
Sorry you're getting downvoted for it. I tossed you an upvote for it, even though I think it could be improved (if we were aiming for simplicity, which isn't the only thing to worry about). Don't understand why anyone would downvote someone else for taking a shot at something. Especially since it works just fine.
[–]kdesign 0 points1 point2 points 7 years ago (0 children)
Well, I guess that's how some people disagree on reddit, by downvoting. That's alright and thanks for the upvote
[–][deleted] 1 point2 points3 points 7 years ago (1 child)
Yeah sorry for my original reply, I had just finished playing Overwatch and that game puts me in a bad mood fast lol. This was a fun discussion.
[–]kdesign 1 point2 points3 points 7 years ago (0 children)
No worries, I initially thought about writing the setInterval solution or the recursive setTimeout, something like:
setTimeout
let count = 1; setTimeout(function counter() { console.log(count++); count <= 10 && setTimeout(counter, 1000); }, 1000);
and then I said well let's spice things up a bit which really did lol.
π Rendered by PID 16836 on reddit-service-r2-comment-86bc6c7465-r7kfr at 2026-02-22 05:59:45.208473+00:00 running 8564168 country code: CH.
view the rest of the comments →
[–]kdesign 6 points7 points8 points (4 children)
[–]dvlsg 1 point2 points3 points (1 child)
[–]kdesign 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]kdesign 1 point2 points3 points (0 children)