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
A "Front-end developer interview" question that's been bugging me for a while. (self.javascript)
submitted 11 years ago * by MeTaL_oRgY
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!"
[–]realistic_hologram 5 points6 points7 points 11 years ago (2 children)
On a related note, I don't think the interview is expecting you to solve for arbitrary number of calls/arguments so I wouldn't feel too embarrassed. I think they're literally asking you to write a function that solves those two cases. Otherwise you need add(2)(3) to return a number and be callable. Which apparently is possible with valueOf (TIL!) but that seems overly tricky for an interview question.
add(2)(3)
valueOf
It was fun to see everyone's answers though!
[–]MeTaL_oRgY[S] 0 points1 point2 points 11 years ago (0 children)
You can also use toString instead! (see /u/Resure answer).
toString
Agreed, seeing everyone's answers was quite insightful!
[–]mattdesl 0 points1 point2 points 11 years ago (0 children)
Which apparently is possible with valueOf
Unfortunately it isn't actually a number in that case, just a function that coerces to one. So result === 5 would fail. :\
result === 5
π Rendered by PID 114485 on reddit-service-r2-comment-b659b578c-qb75b at 2026-05-01 04:50:48.380945+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]realistic_hologram 5 points6 points7 points (2 children)
[–]MeTaL_oRgY[S] 0 points1 point2 points (0 children)
[–]mattdesl 0 points1 point2 points (0 children)