Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我写了一个 JS 文件,其中的一些代码在 ECMAScript 12 中。问题是我所有的设备只支持 ECMAScript 10。这是文件Javascript 是否有可用的在线转换器,或者我该如何手动完成?
你正在寻找Babel。
Babel 基本上可以让你编写现代 JS 代码,然后它可以将其转换为“更原始”的代码,以便在更大的设备集上运行。
有很多选项和很多方法可以用来使用它,但是使用env预设并指定你targets的可能是一个不错的起点。
targets