|
|
|
Interview question for senior front-end engineer
|
|
2 points
by liegroup
3288 days ago
|
|
Thoughts on the difficulty level of the following question for a senior front-end engineer candidate? Interviewer was given 15 minutes to provide the function body for // Contract:
//
// Create a function with a signature:
//
// retry(fn, retryDelay, maxAttempts) -> promise
//
// Implementation:
//
// • retry should call fn; if fn() throws an error error, wait for the retry delay to retry calling fn.
// • if fn() succeeds, the returned promise should resolve with the result of fn()
// • in fn() has been attempted maxAttempts with an error each time, returned promise should reject with the last error
//
function retry(fn, retryDelay, maxAttempts) {
/* ... */
}
I provided some basic assertions to valid the code was working. Solution is about 12-13 lines of code.I remember being able to solve this sight unseen within 15 minutes; I was asked this question on an on-site by a large, well-known tech company. When I tried it again pre-interview it took longer (~30 minutes). Thoughts? |
|
- while an interviewee could be expected to come up with a solution quickly (15 minutes seem more than reasonable), interviews are sometime stressful, people are sometime tired, etc. Some leniency should be applied to the amount of time needed to solving this or any algorihtmic problem.
- not everybody is used to working with promises. What is considered good practice in one company is not necessarily best practice in another one. Any senior front-end dev should at least know about them and be able to pick up a quick definition of the API given by the interviewer and use it in the solution.
If it took you 30 minutes maybe it's not so good to expect interviewees to solve it in 15 ?
On "why did it take you 30 minutes?", only you knows where you spent these minutes and struggled, that is, if you even struggled..