How well do you know Node.js?
A list of specific questions a Node.js developer is expected to answer
I was productive on Node the first few days I started working with it but that did not mean I truly understood what was going on. Unfortunately, when it comes to Node.js, most tutorials and educational resources focus on teaching what you can do with all the packages available for you when you work with Node, like Express and Socket.IO, rather than teaching the capabilities of the Node runtime itself. I think this is a problem.
Don’t get me wrong. To be a productive Node.js developer, you have to learn and understand these packages. But I think before you do so you need a good understanding of the Node runtime itself. You need to be able to write these packages when you need to or at least have the knowledge and confidence to judge a package by its code to make an educated decision to use it or not.
This is why I decided to create a Pluralsight course dedicated 100% to pure Node. While doing the research for the course, I put together a big list of specific questions for you to determine if your knowledge about the Node runtime is already good or if it could be better. If you can answer most of these questions and you’re looking for a job, let me know! If on the other hand, most of these questions take you by surprise, you just need to make learning the Node runtime itself a priority. Your knowledge of that will make you a much more desirable developer.
Some of these questions are short and easy while others require longer answers and deeper knowledge. They are all presented here in no particular order:
- How come when you declare a global variable in any Node.js file it’s not really global to all modules?
- When exporting the API of a Node module, why can we sometimes use
exportsand other times we have to use
- Can we require local files without using relative paths?
- What is the Event Loop? Is it part of V8?
- What is the Call Stack? Is it part of V8?
- What is the difference between
- How do you make an asynchronous function return a value?
- Can callbacks be used with promises or is it one way or the other?
- What are the major differences between
- How does the cluster module work? How is it different than using a load balancer?
- What are the
- How can you read and inspect the memory usage of a Node.js process?
- Can reverse-search in commands history be used inside Node’s REPL?
- What are V8 object and function templates?
- What is libuv and how does Node.js use it?
- How can we do one final operation before a Node process exits? Can that operation be done asynchronously?
- Besides V8 and libuv, what other external dependencies does Node have?
- What’s the problem with the process
uncaughtExceptionevent? How is it different than the
- Do Node buffers use V8 memory? Can they be resized?
- What’s the difference between
- How is the
slicemethod on buffers different from that on arrays?
- What is the
string_decodermodule useful for? How is it different than casting buffers to strings?
- What are the 5 major steps that the require function does?
- What is the
require.resolvefunction and what is it useful for?
- What is the
- What are circular modular dependencies in Node and how can they be avoided?
- What are the 3 file extensions that will be automatically tried by the require function?
- When creating an http server and writing a response for a request, why is the
- When is it ok to use the file system
- How can you print only one level of a deeply nested object?
- What is the
node-gyppackage used for?
- The objects
moduleare all globally available in every module but they are different in every module. How?
- How can a module be both requirable by other modules and executable directly using the
- What’s an example of a built-in stream in Node that is both readable and writable?
- What’s the difference between using event emitters and using simple callback functions to allow for asynchronous handling of code?
requirefunction always caches the module it requires. What can you do if you need to execute the code in a required module many times?
- What’s the difference between the Paused and the Flowing modes of readable streams?
- What does the
--inspectargument do for the node command?
- When working with streams, when do you use the pipe function and when do you use events? Can those two methods be combined?
Thank you Ben Hulan and Kyle Holden for reviewing this article!
Thanks for reading.