When building an application, as our application/code becomes complex we cannot put our entire code in one single file.
As this becomes unmanageable, we use node modular pattern to write different files and export them(which includes functions, objects, and methods) to the main files.
Now you might ask what exactly is a `module`?
In simple terms, a `module` is nothing but a JavaScript file. That’s It.
With the node modular functionality, we can import your own external files, core node modules, and npm modules.
In this article, we are going to discuss, how we can export and import our own files.
Basically, there are two files `calculate.js` from where we will export and import them into the `main.js` …
In this article, we are going to discuss what is NPM (Node Package Manager) and how can we use it in our project.
This is the third part of my Node Module series
So what exactly is Node Package Manager?
The package is a piece of code that is managed by the Package Manager which is nothing but software that manages the installation and updating of packages.
NPM as per the official document: “NPM is the world’s largest software registry. …
In the last article, we discussed how to import our own files in NodeJS which included function, Objects, function constructor, and ES6 classes. You can find that article over here.
Today we are going to discuss how we can import and use Node Core(Native) modules into our own files.
Rather than creating our own custom modules every time, Node provides a set of modules to make our lives easier.
We are going to discuss some of the modules, but you can find the entire list on the official node API document over here
Importing Node modules is similar to that of importing your own modules we use the same require()
function to access it in our own file. …
Tutorial Hell stated as per the urban dictionary
When you are learning Computer Science and programming but unfortunately you don’t understand any of the code you wrote down from the tutorial but it works. Not only that you cannot write your own. It is very hard to get out of this and be able to write your own code. So it is a hell.
Do you agree with the above definition, or does your definition of Tutorial hell is different?
If you ask me, I feel we do understand the code from the tutorial.
It’s just we are so reliant on the tutorial that we feel insecure if we are just given a blank code editor and told to write code or start with a new project. …
Functions are the fundamental part of JavaScript programming language. It is a block of code that is reusable, i.e. the function can be called anywhere in the code and perform the required task as many times as you need it.
In this article, we are gonna take look at various ways/methods of using JavaScript Function
function
keyword along with the name of the function. …
JSON( JavaScript Object Notation) is a storage format that is completely language independent and it is used to store and transport data. It’s quite an important topic as the data which we fetch from external API usually consists of Arrays of elements which are in JSON format.
The syntax of JSON is quite similar to the Object literal syntax which also consists of name, value pairs. But here both names, as well as values, are quoted in inverted commas.
Let us look at the example below :
//Object literals syntax
let details = {
firstName : "John",
lastName : "Adams",
age : 27
}
//JSON syntax
{
"firstName" : "Mike",
"lastName" : "Bush",
"age" : 25…
If you have started learning JavaScript and even if you are in the early stages you must have come across var
, const
, and let
variable declaration.
The const
and let
were introduced in ES6 but before that only var
was the only way of variable declaration. Each one of them has its properties, scopes, and uses.
Let us understand each one of them, the main differences between these ways of declaring variables
Variable declared with var
are mutable i.e. they can be reassigned or even declare first and initialize in another step
var num //num declared -- > value of num is undefined
num = 1 //num initialize/assigned-- > value of num is 1
num = 3 //num reassigned -- > value of num is…
About