Skip to main content

Posts

Showing posts with the label nodejs

NodeJS Interview Questions

NodeJS Interview Questions 1) How to access the Windows Environment Variables programmatically via NodeJS? The process.env will provide the required functionality.    process . env . HOME    process . env . HOMEPATH   In order to have this dynamically we can have      var    nodePath  =  'NODE_PATH' ;    process . env [ nodePath ];   2) What is async and await in NodeJS? async à in simple terms marks the function to run asynchronously await à Marks the caller to wait until the function executes. 3) How to create a directory in NodeJS?      var   fileSystem  =  require ( 'fs' );     var   DIR_NAME  =  'test' ;      if (! fileSystem . exists ( DIR_NAME )){      fileSystem . mkdir ( DIR_NAME );   }   4) How to use jQuery in NodeJS? We need to install jQuery via npm then use it as follows npm   install   jquery Usually point it to $ by var   $  =  require ( 'jquery' );  Sometimes we need to install the