How to make ES6 codes compatible to any devices? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

How to make ES6 codes compatible to any devices?

I'm planning to migrate to ES6 on real projects but don't know how to deal with devices which does not support ES6 syntax. How do you get rid of it aside from not using ES6 (Lol)?

22nd Nov 2018, 6:29 AM
Incognito
Incognito - avatar
2 Answers
+ 17
refer to here: https://www.sololearn.com/Discuss/1220172/?ref=app Original https://code.sololearn.com/Wb7NApdNl761/?ref=app Babel transpiled https://code.sololearn.com/WH9RiWIgduqP/?ref=app all i changed was adding the following to HTML: Babel script <script src="https://unpkg.com/babel-standalone@latest/babel.min.js"></script> to JS (on top): //</script><script type="text/babel">
22nd Nov 2018, 6:43 AM
Burey
Burey - avatar
+ 5
As what Burey refered, you could use Babel transpiler for older browsers that not support ES6.
22nd Nov 2018, 8:39 AM
Calviղ
Calviղ - avatar