ES6 Quick Start - How to Run ES6 in the Browser

The word Babel can be translated as the Tower of Babel.

The Bible, Old Testament, Genesis

Chapter 11 declares that at that time, humans united to build a tower that could reach heaven. To stop this plan, God made humans speak different languages, so they could no longer communicate with each other. The plan failed, and humans scattered across the earth.

This is probably why babel.js is called Babel.

How to Run ES6

Online Compilation

Babel has a REPL online compiler that can convert ES6 code to ES5 directly in the browser.


Using browser.js

browser.js is a browser-side conversion script provided by Babel. You can include it directly in your browser to run ES6 code.

Note: The script tag below must have its type set to “text/babel”

<!DOCTYPE html>
<html lang="en"><head>
    <meta charset="UTF-8">
    <title>ES6 Playground</title>
    <script src="http://cdn.bootcss.com/babel-core/5.8.24/browser.js"></script>
</head>
<body>
    <script type="text/babel">
    // You can now run your ES6 code here
    </script>
</body>
</html>

Article Link:

/en/archive/es6-quick-start/

# Related Articles