In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "what are the Nodejs interview questions". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn this article "what are the Nodejs interview questions?"
Question 1: what is nodejs? Where do we use it?
Nodejs is a server-side technology. It is based on the Google V8 JavaScript engine. Used to develop extensible server programs.
Question 2: why use node js?
Nodejs will make our programming work easier, and it mainly includes the following benefits:
① executes quickly.
② will never stand in the way.
③ JavaScript is a universal programming language.
④ asynchronous processing mechanism.
⑤ avoids the problems caused by parallelism.
Question 3: what are the characteristics of nodejs?
It is single-threaded, but it is highly extensible and uses JavaScript as the mainstream programming language. Asynchronous processing and event-driven mechanisms are used. The processing is efficient.
Question 4: what is the difference between Set immediate and set time out?
Set immediate means to execute immediately. Set time out, the time parameter is passed to 0, and you want to get the same function. Only the former is faster.
Question 5: how to update the version of nodejs?
Npm install npm-g
Question 6: why is nodejs single-threaded?
It is true that Nodejs uses a single thread, but through asynchronous processing, it can handle a large amount of data throughput, resulting in better performance and scalability.
Question 7: what is a callback function?
A callback function refers to passing one function as an argument to another function, which will be called at some point.
Question 8: what is callback hell?
Callback hell is caused by nested callback functions. Such a mechanism can make some functions unreachable and difficult to maintain.
Question 9: how to stop callback to hell?
There are three ways to deal with each error to ensure the penetration of the code and the modularization of the program code.
Question 10: explain the role of repl?
Read evaluate print loop, for testing, debugging and experimental use.
Question 11: what are the types of API functions?
There are two kinds: one is blocking function. Blocking functions wait for the operation to complete before moving on to the next step.
The other is a non-blocking function. This function uses a callback function to handle the results obtained by the current function.
Question 12: what is the first parameter of the callback function?
It's usually the wrong object. If this parameter is empty, there are no errors.
Question 13: what is the function of NPM?
Node package manager has two main functions.
It is the storage medium of a network-end module.
Its other role is installer dependency and version management.
Question 14: what is the difference between nodejs and ajax?
Nodejs and ajax, also known as asynchronous JavaScript and xml, are expressed through JavaScript, but their purposes are completely different.
Ajax is designed to update an area of the page dynamically, so that there is no need to update the entire page.
Nodejs is used to develop client-server type applications.
Question 15: explain chaining in nodejs.
Chaining refers to the link from one data stream to another, thus implementing multiple stream operations.
Question 16: what is streams? Explain what types there are?
The concept of stream is uninterrupted. It can read data from or write data to a place without interruption.
There are four types of stream data. Readable and writable. It can be read, written and transformed.
Question 17: what is the exit code? What exit codes are there?
The exit code refers to the code returned when interrupting the nodejs run.
There are several kinds of unused, uncaught fatal exception, fatal error, non function internal exception handler, internal exception handler run time failure,internal JavaScript evaluation failure.
Question 18: what is globals?
There are three keywords for global.
Global represents the topmost namespace and is used to manage all other global objects.
Process is a global object, which can convert asynchronous functions into asynchronous callbacks. It can be accessed anywhere. It is mainly used to return application information and environment information of the system.
Buffer is a class used to deal with binary data.
Question 19: what is the difference between Angular js and node js?
Angular js is a network application development framework, while nodejs is a real-time system.
Question 20: why is a unified style so important, and what tools are there to ensure this?
A unified style allows all team members to write code according to one rule. The tools are Standard and eslint.
Question 21: what is the way to handle unhandled exceptions?
Use domain to handle such exceptions between the application and the node js.
Question 22: how does Node js support multiprocessor platforms?
The Cluster module is used to support this. It allows multiple nodejs worker processes to run on the same port.
Question 23: how to configure the environment of development mode and production mode?
First there is a configuration file, and then the corresponding configuration content is obtained through the environment variable parameters.
Question 24: what are the time-related functions in nodejs?
① Set time out,clear time out.
② Set interval,clear interval.
③ Set immediate,clear immediate.
④ Process.nextTick.
Question 25: explain what reactor pattern is.
Reactor pattern is mainly a non-blocking iUnivero operation. Provides a callback function to correlate the io operation. Whether the io request will be submitted to demultiplexer after completion is a notification interface used to handle concurrent non-blocking io operations. This function is achieved by querying an event loop.
Question 26: what does the lts version mean?
That's the long term support version. Will be supported for at least 18 months. It is identified by an even number. This version has a guarantee of stability and security.
Question 27: why do you need to separate express APP from server?
Separate to facilitate maintenance and testing, when testing a module, especially the APP module, you do not need to work on the network connection configuration.
Question 28: what is the difference between next tick and setImmediate?
Next tick waits for the current event execution to complete or the next round of event loops to arrive before execution.
Set immediate, in the next round of event loops, executes the callback and returns the current loop for reading and writing.
The above is all the contents of the article "what are the Nodejs interview questions?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.