Okay, so why are we talking about remote Node.js developers specifically? When hiring a Node.js developer from a freelancing platform, you rarely get an idea of how well-vetted they are. As a consequence, you need to check if they’re comfortable with the fundamental aspects of the technology.
So what questions do you ask when interviewing remote Node.js developers for hire? Is there a question matrix or a list of some sort that you use? Imho, the most annoying thing about making lists of interview questions is that you always feel like you’ve left out an important point.
To get rid of this pesky feeling, I’ve studied several posts about Node.js interview questions. After that, I asked our Node.js tech lead to tell me which of the questions actually mattered — and I ended up with this list. The 5 points listed below provide the topics that you’d want to consider when interviewing remote Node.js developers.
So what exactly would you ask about? For starters, ask your candidate how hosting affects:
- … var declarations versus let and const declarations. Hint: when accessing the former before declaration, you’ll get undefined. In case of the latter two, you’ll get an error.
- … function declarations vs function expressions and class declarations. The former can be accessed before declaration, while the latter two can’t.
2. What are pure functions?
According to our Node.js lead, pure functions are pure fun:). Sure, that’s not the only reason why your remote Node.js developer needs to be familiar with them. We all know that pure functions improve testability (which is good for TDD), and make your app architecture more reliable on the overall. Besides, we all know that pure functions:
- always produce the same output given the same input,
- don’t create side-effects,
- don’t rely on an external mutable states.
Basically, these three points are what your prospective remote developer should tell you during the Node.js interview. Here’s an awesome article by Eric Elliot that provides you with an in-depth coverage and examples of pure functions.
3. What is the difference between setTimeout, setInterval, setImmediate, and nextTick?
So what is the difference between setTimeout, setInterval, setImmediate, and nextTick? In short:
- setTimeout calls a function once after a specified delay (e.g. after 5 seconds).
- setInterval calls the function repeatedly, at specified intervals (e.g. every 5 seconds).
- setImmediate puts the function at the end of the event queue (e.g. after I/O event callbacks that are already in the event queue).
- nextTick puts the function at the head of the event queue, before I/O or timer callbacks. That is, the delayed function will run immediately after your current function, before other operations.
4. How does the thread pool work in Node.js?
What exactly do we mean when we say that Node is single-threaded? When interviewing a remote Node.js developer, expect to hear that non-blocking operations are executed concurrently with your JS code. So why does this happen with a single threaded server technology?
Thing is, Node’s C++ based API, as well as some of its functions and modules support asynchronous I/O. When called, these functions and modules pass the call to a worker thread. Non-blocking operations are processed in this worker thread. Once the value is returned (or an error is thrown), the worker thread will present them to the event loop.
5. How does garbage collection work in Node.js?
Understanding of how garbage collection works in Node indicates in-depth knowledge of the technology. Namely, you might want to ask your prospective remote Node.js developer if V8 uses a stop-the-world garbage collection mechanism. As far as details go, here are several questions worth including into this block:
- Stack vs heap. Hint: the former contains primitive types and variables while the latter stores JS objects, strings and closures.
- New Space — the memory segment that stores recent allocations. The objects populating it are known as the Young Generation. The garbage collection algorithm used in the New Space is Scavenge collection.
- Old Space — the memory segment storing objects that have survived Scavenge collection in the New Space. Objects that populate the Old Space are the Old Generation. The GC algorithm that runs in the Old Generation is Mark-Sweep collection.
Besides, you’d probably want to check if your remote Node.js developer is comfortable working with heapdump. In case you’re looking for a more comprehensive post on garbage collection in Node, take a look at this one.
* * *
The five questions listed in this post will provide you with a better understanding of your candidate’s experience with the technology. Still, it might prove a wiser choice to hire a remote Node.js developer from a company that vets candidates for you.
Here, at DedicatedTeams, we put a particular focus on candidate selection. Our selection process included test projects and technical screening that covers both basics and in-depth aspects of the technology. As a result, 93% of CTO and CEO we’ve worked with recommended us to others.
Contact us, and tell us about your challenge. Chances are, the remote Node.js developers from DedicatedTeams are the ones you’ve been looking for;).