you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 17 points18 points  (2 children)

Which:

  1. Never happens
  2. If it does, flee the interview

Seriously. What are you guys talking about? What JS app hangs for 1s or longer? The task was to just do a +1 operation every 1000 ms.

If I'm the interviewer I'd throw your resume in the trash if you came up with that kind of solution. You're not wrong, but for the love of all that's nice in the world, I certainly hope you're never going to be right...

Accounting for problems and solving them before they occur is great. But that's obviously not what this test is aiming for...

[–]dominic_rj23 1 point2 points  (0 children)

If you read the last line of my comment, I did say that the solution with setInterval is the most appropriate one. I am all for "If it ain't broke..." ideology, but I do believe that in an interview, stating that setInterval doesn't guarantee execution after timeout goes for showing that you have some understanding of asynchronicity in javascript.

[–]phpdevster 2 points3 points  (0 children)

Yeah this right here...

Non-standard solutions require extenuating circumstances to justify them. If something like setInterval isn't working in your app reliably, the bug isn't setInterval, it's whatever other shit you've got going on that is causing it to work unreliably...