Who is the creator of Node.js and when was it initially released?
Ryan Dahl is the creator of Node.js. The development was sponsored by Joyent and it was initially released in 2009.
What is npm
?
npm
is Node.js' package ecosystem. It is the largest ecosystem of open-source libraries in the world. It is also the name of the command line package manager used to interact with npm
.
What is the name of the file which npm
uses to identify the project and its dependencies?
Its name is package.json
.
What are the names of at least three of the most popular Node.js frameworks?
Express, Koa, Hapi, Meteor, Sails, Loopback etc.
What is the name of at least one framework that utilizes Node.js for development of desktop apps?
Electron, NW.js, App.js etc.
What is the alternative to the Node package manager (npm
), which was introduced by Facebook in 2016?
yarn
.
What is the difference between dependencies
and devDependencies
?
Both are defined in the package.json
. dependencies
lists the packages that the project is dependent on. devDependencies
lists the dependencies which are only required during testing and development.
What is REPL and how can you access it from the command line?
REPL stands for "Read Eval Print Loop." It is an interface for easily running Node.js code. It can be started from the command line using the node
command.
What is the name of the JavaScript engine that Node.js is built upon?
Chrome's V8 engine.
Does Node.js operate in a single-threaded or multi-threaded fashion?
Node.js operates on a single thread.
What is the event loop
?
Node.js processes incoming requests in the event loop
. It is what allows Node.js to perform non-blocking operations despite the fact that JavaScript is single-threaded.
What is libuv
?
The C library that implements the event loop and all of the asynchronous behaviors.
What is Node.js' Cluster module?
A module used to take advantage of multi-core systems, so that apps can handle more load.
Which keywords are used to export and import an object or a function from a module file?
module.exports
is used to export an object or a function. require
is used to import one.
Which global variable can be used to access information about the app and the environment that it runs in?
The process
variable.
What is __dirname
?
A global variable which returns the absolute path of the directory containing the currently executing file.
What is a blocking function?
Unlike non-blocking functions, a blocking function's execution must be completed before other statements are executed.
Which is the first argument usually passed to a Node.js callback handler?
It is an error object, which is null or undefined if an error did not occur.
What does "callback hell" mean?
Plenty of nested callbacks lead to callback hell. They make code difficult to read and maintain. One of the ways to deal with callback hell is to use the async
/await
syntax.
What are async
and await
?
A function marked with the async keyword can contain an await expression. The await expression pauses the execution of the function and waits for the resolution of the passed Promise. It then resumes the function's execution and returns the resolved value.
What is the difference between setTimeout
and setImmediate
?
setTimeout
is used to run a function after a certain minimal timeout. setImmediate
is used to run a function once the current event loop completes.
Does the fs
module, used for file-based operations, offer the possibility for synchronous or asynchronous reading and writing?
fs
offers both synchronous and asynchronous methods for reading from and writing to files.
What are the two methods in the fs module that can be used for reading a whole file at once?
fs.readFile
and fs.readFileSync
.
How are objects that generate events called and which class from the events module are they instances of?
These objects are called event emitters and are instances of the EventEmitter
class.
What keyword do you need to use to insert a debug breakpoint?
The debugger
keyword.
Ready to get started?
Get in touch or schedule a call.