Advertisement
mvsil

Node.js interview

Mar 26th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. %%% WHAT IS NODE.JS %%% - Node.js is a Server side scripting which is used to build scalable programs. Its multiple advantages over other server side languages, the prominent being non-blocking I/O.
  2.  
  3. %%% CALLBACK FUNCTION %%% - Callback function is used in node.js to deal with multiple requests made to the server. Like if you have a large file which is going to take a long time for a server to read and if you don’t want a server to get engage in reading that large file while dealing with other requests, call back function is used. Call back function allows the server to deal with pending request first and call a function when it is finished.
  4.  
  5. %%% CLOSURES %%% - A Closure is a function defined within another scope that has access to all the variables within the outer scope. Global variables can be made local (private) with closures.
  6.  
  7. %%% PROMISES %%% - A Promise is an object representing the eventual completion or failure of an asynchronous operation.
  8. Essentially, a promise is a returned object to which you attach callbacks, instead of passing callbacks into a function.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement