by koonsolo · 6y ago · 0 comments
A senior should know that JavaScript runs single threaded with an event loop, and therefore doing heavy calculations will block your user interactions.
If you don't know this, you also won't know when to use WebWorkers etc.
Juniors can learn, seniors should be the ones teaching them. Seniors should define the architecture of your solution, and solve weird problems. You cannot do this without proper in-depth knowledge.
There are plenty of ways to see how this person came into contact with the event loop concept, whether in theory or in practice.
And yeah, you might agree on Node behaving differently, but that just proves the question is very bad. Even with "in browser" clause the answer can change tomorrow for all we know.
It is like asking about undefined C++ behavior in an intentionally very bad example.
By the way, only 1 out of 10 frontend developers can answer what the event loop is, according to my experience.
A few weeks ago I interviewed a front-end developer who said that in his current job he rolled into production some code that blocked the UI for nearly 1 minute, and that problem was only noticed in production because during testing they didn't used realistic data.
He then said that his approach to solve the problem was to rewrite everything from scratch using a faster framework.
Unloading the blocking tasks to web workers wasn't even in his universe of potential alternatives.
Suffice to say, he was not hired.
If you're applying for a front-end position and are oblivious to basic GUI principles, such as how not to block the UI, then you might not be lucky.