|
|
|
|
|
by jnbiche
4591 days ago
|
|
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'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.