substr() vs substring() in JavaScript

substring() and substr() are among the most popular methods in JavaScript. But, for a new developer, it creates confusion which one to use. thought of clearing the minor difference that exists between these two APIs. Let’s consider an example. var text = “This world is a great place to live”;   // substring – Start…

Synchronous & Asynchronous File Handling in NodeJS

File Handling plays an important role in NodeJS. By using this feature, we can access data present in different files present in different locations. File handling in NodeJS is done by adding ‘fs‘ module in our project. So our first step will be to create an object of type ‘fs‘, which is mentioned below: var…

Buffers in NodeJS

The term Buffer means an intermediate storage for storing data. Buffers have a limited or predefined storage. A new buffer can be defined in a node as below. var buf = new Buffer(‘Hello’, ‘utf8’); If we console log above line then the output will be: <Buffer 48 65 6c 6c 6f> where each number is…

How NodeJS works Asynchronously

We know that NodeJS is asynchronous. But the V8 engine upon which it is built is synchronous (meaning one process at a time). So, how come Node works? There are basically three major components which Node deals with – V8 (engine), libuv (multi-platform C library ) and Operating System. So when some event occurs or…