+ 1
Why does JS ES6 not work on my PC?
5 Antworten
+ 5
It is because ES6 is not supported in your browser. To solve this, you should include Babel in your script. This is how you do it :
Add it in your head tag.
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.21.1/babel.min.js"></script>
Then,
<script type="text/babel">
// ES6 goes here
</script>
+ 5
You can do what Arb said but that will take some extra time to load and you will always need internet to run that.
Simple solution for this is to install latest browsers likes Mozilla or chrome.
If you have them installed then check for update, ES6 is not supported in old browsers.
+ 1
Aha thanks a lot :)
0
I see..I will try that then. Thanks Rick.
0
You don't have to include babel by CDN as the dude on the top showed. Use webpack. It's bundler, that compiles your js files into one bundle. With webpack it's possible to install necessary packages via command line. In the end you will include that bundle in your html.
Install node js on your machine, by default nodejs ships with npm (node package manager). Then use npm to install babel. Include babel in your js file. And enjoy!