Yes, you can use let within node.js, however you have to run node using the optional –harmony flag. Try the following test.js:
"use strict"
var x = 8,
y = 12;
{ let x = 5, y = 10; console.log(x + y); }
console.log(x + y);
And then run the file node --harmony test.js
which results in:
15
20
I would not recommend using this in an important production application, but the functionality is available now.
Related Contents:
- Why do I get the ERROR: “No ‘Access-Control-Allow-Origin’ header present on the requested resource” although I specified the necessary header? [duplicate]
- When is .then(success, fail) considered an antipattern for promises?
- module.exports vs exports in Node.js
- SyntaxError: Cannot use import statement outside a module
- How do I fix CLIENT_MISSING_INTENTS error?
- Callback after all asynchronous forEach callbacks are completed
- Javascript – get array of dates between 2 dates
- How to run Gulp tasks sequentially one after the other
- Is “.then(function(a){ return a; })” a no-op for promises?
- How to create an HTTPS server in Node.js?
- Electron require() is not defined
- ES6 variable import name in node.js?
- Difference between microtask and macrotask within an event loop context
- Render basic HTML view?
- Nodejs Event Loop
- Coordinating parallel execution in node.js
- Rails – Could not find a JavaScript runtime?
- Write / add data in JSON file using Node.js
- Failed to load c++ bson extension
- How to search in array of object in mongodb
- How to stop babel from transpiling ‘this’ to ‘undefined’ (and inserting “use strict”)
- Scaling Socket.IO to multiple Node.js processes using cluster
- Javascript ES6 TypeError: Class constructor Client cannot be invoked without ‘new’
- Converting a Buffer into a ReadableStream in Node.js
- How to request the Garbage Collector in node.js to run?
- javascript – Why is there a spec for sync and async modules?
- Curly brackets (braces) in Node.js ‘require’ statement
- Using filesystem in node.js with async / await
- Execute an exe file using node.js
- dotenv file is not loading environment variables
- Load and execute external js file in node.js with access to local variables?
- stop all instances of node.js server
- Puppeteer log inside page.evaluate
- How to add custom html attributes in JSX
- Reading Excel file using node.js
- Pattern for CoffeeScript modules [duplicate]
- XMLHttpRequest cannot load No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:3000’ Google maps
- Download text/csv content as files from server in Angular
- Querying by a field with type ‘reference’ in Firestore
- Sending private messages to user
- Can I determine if a string is a MongoDB ObjectID?
- How to make Puppeteer work with a ReactJS application on the client-side
- Why is process.env.NODE_ENV undefined?
- How to build minified and uncompressed bundle with webpack?
- Uncaught Error: Module did not self-register
- Calculating the shortest route between two points
- How to structure nested Promises
- Node.js POST causes [Error: socket hang up] code: ‘ECONNRESET’
- “unexpected token import” in Nodejs5 and babel?
- Node.js mongodb driver async/await queries