Home >Development Tools >VSCode >How to convert ES6 to ES5 with VSCode?

How to convert ES6 to ES5 with VSCode?

Guanhui
GuanhuiOriginal
2020-06-08 10:56:064397browse

How to convert ES6 to ES5 with VSCode?

#How to convert ES6 to ES5 with VSCode?

VSCode cannot convert ES6 to ES5, but it can be achieved through the Babel library. Babel is a tool chain mainly used to convert the ES5 version of the code into backward-compatible JavaScript syntax so that it can run Runs in current and older versions of browsers or other environments.

Example

// Babel 输入: ES2015 箭头函数
[1, 2, 3].map((n) => n + 1);
// Babel 输出: ES5 语法实现的同等功能
[1, 2, 3].map(function(n) {
  return n + 1;
});

History of ECMAScript

ES6 is the biggest change in the ECMAScript standard in more than ten years version, which adds many new syntax features.

  • 1997 ECMAScript 1.0 was born.

  • In June 1998 ECMAScript 2.0 was born, containing some minor changes to synchronize the independent ISO international standard.

  • ECMAScript 3.0 was born in December 1999. It was a huge success and received widespread support in the industry. It laid the basic syntax of JS and was completely inherited by subsequent versions. To this day, when we start learning JS, we are actually learning version 3.0 of syntax.

  • ECMAScript 4.0 in 2000 was the predecessor of the current ES6, but because this version was too drastic and a complete upgrade to ES 3, it was temporarily "harmonized".

  • In December 2009, ECMAScript version 5.0 was officially released. The ECMA Expert Group expects the fifth version of ECMAScript to become a mainstream development standard between mid-2013 and 2018. In June 2011, ES version 5.1 was released and became an ISO international standard.

  • In 2013, the ES6 draft was frozen and no new features would be added. New features will be put into ES7; in June 2015, ES6 was officially adopted and became an international standard.

Recommended tutorials: "JS Tutorial", "vscode Getting Started Tutorial"

The above is the detailed content of How to convert ES6 to ES5 with VSCode?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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