Home > Web Front-end > JS Tutorial > Node.js check for ES6 support

Node.js check for ES6 support

巴扎黑
Release: 2017-07-18 16:24:36
Original
1847 people have browsed it

ode.js is developing very fast, and its support for es6 features is becoming more and more conscientious. However, there are many versions of node.js, and each version has different support for es6. In order to clearly understand how each version supports es6 features To support, there needs to be a tool that can provide clearer support instructions, and can even provide support for a certain feature by calling it in the program, and help the program selectively use es6 features.

es-checker provides relatively easy-to-use related functions. It can detect the current node and provide feature support instructions. It can also provide methods in the program to detect whether a certain feature is supported.

Installation and detection

The current node version is v6.9.4.

Global installation

npm install es-checker -g
Copy after login

After installation, execute in the command line

es-checker
Copy after login

Execution result

The es feature in the program supports detection

var Supports = require("es-checker"); 
if (Supports.letConst) {
  let x = 5;
} else {  var x = 5;
}
Copy after login

Reference:

es-checker’s github

End

The above is the detailed content of Node.js check for ES6 support. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template