美文网首页
在网页中使用ES6

在网页中使用ES6

作者: 记忆是条狗 | 来源:发表于2017-01-17 15:59 被阅读0次

用法一:

<script src = "http://google.github.io/traceur-compiler/bin/traceur.js" type="text/javascript"></script>
<script src="http://google.github.io/traceur-compiler/src/bootstrap.js" type="text/javascript"></script>
<script type="module">
  //ES6代码
</script>

这里的bootstrap和css里的那个bootstrap是完全不一样的东西。

用法二:

在线编译-----主要用于测试
1.https://babeljs.io/repl/ (babel的)
2.https://google.github.io/traceur-compiler/demo/repl.html (谷歌的)

用法三:

直接在node环境中使用
①直接用,需要添加"use strict";

"use strict";
let a="test";
console.log(a);//test

②如果某些功能无法使用的话就需要加参数:

node --harmony_desctructuring xxx.js

相关文章

网友评论

      本文标题:在网页中使用ES6

      本文链接:https://www.haomeiwen.com/subject/vqwmbttx.html