0

Now that ECMAScript 2015 (or ES6) has a wider support in Node.js as well I have seen a few examples where people started to use the let keyword when requiring packages. I wonder what is the difference (if any) or what is the recommended way or working with packages in ES6 & Node.js.

Essentially what's the difference between:

var express = require('express');`

and

let express = require('express');`
Kirill Fuchs
  • 13,446
  • 4
  • 42
  • 72
Tamas
  • 10,953
  • 13
  • 47
  • 77
  • Without the wider context, there's no difference between those two lines. – James Thorpe Dec 24 '15 at 10:12
  • That's what I thought @JamesThorpe as well - I thought that maybe there are some 'best practices' that come out lately that I have potentially missed. – Tamas Dec 24 '15 at 10:13
  • 2
    *"what is the recommended way"* I'd use `const` (since I assume you don't want to reassign imports anyway). – Felix Kling Dec 24 '15 at 10:13
  • I'm not saying there is _no_ difference, but how they differ depends on exactly where and how those lines are present in a source file. – James Thorpe Dec 24 '15 at 10:13

0 Answers0