freeCodeCamp/guide/chinese/miscellaneous/write-and-run-es6-code-in-t.../index.md

898 B

title localeTitle
Write and Run Es6 Code in the Browser 在浏览器中编写并运行Es6代码

在页面中包含以下代码。

<!-- Write these first. Here `bootstrap.js` doesn't mean Twitter Bootstrap. --> 
 <script src="https://google.github.io/traceur-compiler/bin/traceur.js"></script> 
 <script src="https://google.github.io/traceur-compiler/src/bootstrap.js"></script> 
 
 <!-- Edit the src. Write `type="module"` (important) for linked script --> 
 <script src="app.js" type="module"></script> 
 
 <!-- Remember to write `type="module"` for embedded script --> 
 <script type="module"> 
    //→ write your script here 
 </script> 

请参阅: Traceur编译器入门

演示: ES6 Demo Repo Source