Node.js is a popular runtime to write apps. These apps are often production quality apps that are used by many people. To make maintaining them easier, we’ve to set some guidelines for people to follow.
Prefer const over let. Ditch the var
var is an outdated keyword for creating variables that should never be used again. The scope is inconsistent unlike
var is function scoped, so that it can be accessed from outside blocks and create potential issues with our code.
const are blocked scoped so they can’t be accessed outside a block.
const prevents reassignment of the constant to another value.
For example, if we have the following code: