How to update npm to latest version

In this another small article, I am going to explain How to update npm to latest version. In order to update the npm to latest first you should know which version you are currently using. So to check that use the below command.

npm -v

Now I will show you how to update npm to latest version

Its a pretty small code that will update the npm to the latest version.

npm install npm@latest -g

How to update npm to latest version

It will update to the current stable version of NPM. You can find the reference from here

Difference between req params req body and req query in Nodejs

Hello guys,

In this small article, I am going to show you the Difference between req params req body and req query in Nodejs

How req.params works

req.params get the data from the segment of the url where the route name starts with " : ". For eg: https://localhost:8081/movie/:movieid becomes https://localhost:8081/movie/5896544

Now the required code to get the value of req.params.movieid is 5896544

So,

req.params.movieid = 5896544

How req.body works?

req.body properties come from a form post or body section where the form data has been parsed into properties.
req-body nodejs

How req.query works?

req.query comes from query parameters in the URL such as https://localhost:8081/movie?name=boss where req.query.name === "boss".

Hope you are now clear between the key difference between request-params, request-body and request-query.

Create Pyramid structure from javascript

In this article, I am going to show you how to create a pyramid structure from javascript.

Create Pyramid structure from javascript simple nested loop

var rows = 10

for(var i=0; i<=rows; i++){
	for(var k=1; k<=rows-i; k++){
		document.write(" ")
	}
	for(var j=0; j<=i; j++) {
		document.write("* ");
	}
	document.write("
") }

The above code with return a pyramid structure as shown in featured image.