Skip to main content

Posts

Featured

Node.js interview questions set 1

  Let start with set 1, 1)error-first callback in node?  This question is asked many times don't know what special it is. Ans: The pattern used across all the asynchronous methods in Node.js is called Error-first Callback. Here is an example: fs.readFile( "file.json", function ( err, data ) {   if ( err ) {     console.error( err );   }   console.log( data ); }); Any asynchronous method expects one of the arguments to be a callback. The full callback argument list depends on the caller method,  but the first argument is always an error object or null.  When we go for the asynchronous method, an exception thrown during function execution cannot be detected in a try/catch statement. The event happens after the JavaScript engine leaves the try block. In the preceding example, if an exception is thrown during the reading of the file,  it lands on the callback function as the first and mandatory parameter. 2)What is a stub?  Ans: Stubs are functions/programs that simulate the

Latest Posts

Rapid fire 28 javascript questions and answers .

Mongodb Basics Set 1: Insert Operation

Coding interview questions set 7

Data structure problem 2 (Stack): Valid Parentheses problem.

Create a multi column csv report in nodejs without external library.

Javascript interview questions set 3

CSS INTERVIEW QUESTIONS SET 2

Coding Interview questions set 6

Node.js: create an excel file with multiple tabs.

Coding Interview Questions set 5