Hacker News new | ask | show | jobs
by epayne 4591 days ago
I think the interview question detailed in the post makes a fine web development Fizz Buzz Test. It may not define the hard skill floor but not being able to answer this question correctly clearly identifies a candidate that has not written or read much Javascript at all. Basic JS experience and skill is a requirement for web development work today.
2 comments

I'm sorry, I'm going to step in here and call you on this. This is nowhere near the skill level of a Fizz Buzz test. I mean, it may be a legitimate question to ascertain the presence of an intermediate-to-advanced web developer, but fizz buzz is something any reasonably competent beginner-to-intermediate programmer can figure out, even if they haven't run into it before.

This is not even testing an obscure application of closures. I mean, the trick here is not knowing about closures, but about knowing the details of the setTimeout function -- specifically, that there is a corresponding clearTimeout function (which, as a non-specifically frontend developer, I had long forgotten if I ever knew it).

That's not testing programming competency, that's testing knowledge of the JS standard library, and secondarily knowledge of closures. I mean, it's a legitimate thing to test for, but let's not pretend it's somehow analogous to fizz buzz.

Edit: And none of you even mentioned the error in his code, which another commenter pointed out: wrong function. It should have been clearTimeout

I disagree with you on this. The point of the interview as I read it was to test an understanding of closures, scoping, and really basic programming logic.

I've been asked similar questions in interviews, and when I haven't known the little bit of factual information required (in this case the existence of setTimeout and clearTimeout), I've asked to Google it, and my interviewers have always been more than happy to let me. I've passed interviews doing this. I've even had friends who do interviews tell me that 'googling an answer' is often the correct answer.

I personally think the choice of setTimeout/clearTimeout was a really good one because almost all JS devs will know it, but it's also really easy to find online if you know what you're looking for. This test is really about coming up with a good way to solve a problem.

I don't know if I agree - I've done plenty of setTimeouts in my life, but I can't remember if I've ever needed to cancel one before it fired, though. It seems slightly esoteric. (Then again, I don't sell myself as a front-end developer)
Agreed. I use setTimeout a lot, but generally don't need to cancel it. But the failure of the interviewee was not the part where he doesn't know how to cancel it, I think, but rather that he didn't know about setTimeout at all.