Home >Web Front-end >JS Tutorial >Node.js check for ES6 support
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
After installation, execute in the command line
es-checker
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; }
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!