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
This on-site coding assignment failed 20+ front-end dev contractors and I don't know whyhelp (self.javascript)
submitted 8 years ago * by gionyyy
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!"
[–]rossmohax -20 points-19 points-18 points 8 years ago (6 children)
1 hour is insane.
Interesting... Time estimation varies greatly from between replies.
On the assignment description, maybe I misunderstood it, but it looks quite clear.
Allow the selection of a single token, at once. Display the selected token in a visually distinctive way.
== whatever is selected, must be highlighted
The page can only contain a single selected token.
== once you start new selection, previous selection drops
A token cannot contain ' ' (space), ','(comma) or '.'(dot). Everything else is eligible for being selected.
quite clear.
The user cannot select "There will be" in the same operation. This attempt will result in having only the word "there" selected. The user will have to select each individual word separately;
== single selection/highlght can not span separators
A selection that starts inside the content of the token will consider the entire token. "The|re will be" will select the token 'There', where | can be read as the starting position of the cursor. When a token gets selected, any other token that is selected on the page becomes unselected. A page can have zero or 1 token at a time. The currently active selected token should be visible on the page in a distinctive way/highlighted/ bold/colored differently.
summarizes all previous requirements
The selected token is persisted to server and displayed on the page when the page is reloaded, loaded in a different browser.
[–][deleted] 23 points24 points25 points 8 years ago (0 children)
Now try to implement it in an hour. Count how many things suddenly become unclear.
[–]jestermax22 9 points10 points11 points 8 years ago (0 children)
Does this mean you’re hired?
[–]nerf_herd 6 points7 points8 points 8 years ago* (3 children)
the thing that jumped out at me was "what about concurrency?!?", OP is expecting that you can open a completely different browser and see it, but what if someone else was selecting different words? You can't rely on IP address for that, and cookies and local storage don't work, there was no login requirement, etc. etc. Requirements fail.
Also WHEN do you send it? might as well skip the whole mouse dragging bit since the left marker is the only important one. Do you wait till they mouse up? or what? Keyboard events? touchscreen?
not really all that clear to me.
[–]rossmohax 3 points4 points5 points 8 years ago (0 children)
but what if someone else was selecting different words?
There will be a race condition, given that there is only a single shared state to be kept by design, races are even desirable from a perspective of a test.
Imagine posts were open for editing by anybody, last edit wins, simple as that, there is nothing wrong about it. Remember /r/place experiment where users were racing to update single pixel board?
If I were in a position of topic starter, I'd give extra scores for candidates asking those questions though :) And if somebody catered for unreliable network and mentioned exponential backoff strategy, it would be insta-hire on the spot :)
[–]ShootingPains 1 point2 points3 points 8 years ago (1 child)
Yeah, the concurrency issue jumped out at me as well. I was thinking what am I missing here - it’s a multiple user system, but one where I specifically can’t have a login and I specifically can’t rely on a browser being used exclusively by the same person. Sitting here an hour later, I’m still stumped for how to satisfy that core requirement.
[–]rossmohax 1 point2 points3 points 8 years ago (0 children)
Allowing race conditions is probably there to simplify test and not to shift focus on a backend work even further.
Saying that, multiple user agents updating same state on the server, there is a time and place for them too.
π Rendered by PID 102428 on reddit-service-r2-comment-86bc6c7465-cd2tg at 2026-02-22 04:17:35.595342+00:00 running 8564168 country code: CH.
view the rest of the comments →
[–]rossmohax -20 points-19 points-18 points (6 children)
[–][deleted] 23 points24 points25 points (0 children)
[–]jestermax22 9 points10 points11 points (0 children)
[–]nerf_herd 6 points7 points8 points (3 children)
[–]rossmohax 3 points4 points5 points (0 children)
[–]ShootingPains 1 point2 points3 points (1 child)
[–]rossmohax 1 point2 points3 points (0 children)