Showing posts from June, 2020

Javascript/Node.js: 2 Features that you might not know.

This is a very short article where we will be discussing two Javascript features that you may not know. Also, you may like this article about two new Node.js features.    So let's start, 1)Exponentiation operator(**): This operator was added in ES6 and is supported by most of the browsers but excluding internet explorer. It is also called an Infix operator for Exponentiation. Before for exponentiation, we have to use Math.pow(x,y). But now you can use x**y. For example: 2**5 //returns 32 2)Numeric Separators: Large numeric literals are difficult for the human eye to parse quickly, especially when there are lots of repeating digits. To improve readability, you can use underscores as separators in numeric literals. For example: let value= 100_000_000_00 //Is same as 10000000000 As of May 2020, It is supported by all major browsers (Chrome[75+], Firefox[70+], Edge, Safari[13+], Opera) ( source 1 , source 2 for more details about differe

Node.js: Bundling your Node.js application to single executable for Windows.

In this article, we will see how to bundle Node.js application to a single executable for Windows. What's the need? Well recently, I had taken a work where I needed to convert pdf's(Of similar format) to excel sheet. So I was reading the pdf's from a folder in desktop and I was storing the output excel sheet into a separate folder on the desktop. I used Node.js for the program. Now the client wanted it to install the program on 25 windows machine and his budget was really low. So it was also not possible for me to install node.js for 25 machines and then install the required dependency for each one. One of the solution: While I was searching for an easy solution I found this amazing npm module pkg . This module can make your node.js app work like plug and play type. No need to install Node.js on the client machine or any other dependency.  It helps to make a commercial or trial version of your node.js application without exposing the source code. I found