Search code examples
javascriptecmaecmascript-2021ecmascript-2019

How to convert ECMAScript 12 to ECMAScript 10


I wrote a JS File, some of the codes in it are in ECMAScript 12. The problem is all my devices support only ECMAScript 10. This was the file Javascript Is there any online converters available, or how can I do it manually?


Solution

  • You're looking for Babel.

    Babel will basically let you write modern JS code and then it can transpile it to "more primitive" code in order to run on a larger set of devices.

    There are a bunch of options and a bunch of ways you can go about using it, but using the env preset and specifying your targets is probably a good place to start.