+ 1

Why does JS ES6 not work on my PC?

4th May 2020, 6:54 AM
Shipra Waghmare
Shipra Waghmare - avatar
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>
4th May 2020, 6:59 AM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
+ 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.
4th May 2020, 7:02 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
Aha thanks a lot :)
4th May 2020, 7:00 AM
Shipra Waghmare
Shipra Waghmare - avatar
0
I see..I will try that then. Thanks Rick.
4th May 2020, 7:03 AM
Shipra Waghmare
Shipra Waghmare - avatar
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!
4th May 2020, 12:00 PM
Timur Myngbay
Timur Myngbay - avatar