Friday, 26 May 2017

What is the best way to require node modules var or const?

When we are requiring node modules to suck as express, bodyParser we will use var keyword to create a variable and assign the module. Can't we use the const to declare such modules?

var express = require('express');
var app = express();

or defining above as be

const express = require('express');
const app = express();

What is the best way? and why is that?



via Dhanuka Perera

No comments:

Post a Comment