Chrome 上的箭头函数 iOS

Arrow functions on Chrome for iOS

当我在 iPhone 6s 上使用 Chrome 访问我的网站时,我的 d3.js 图表显示不正确。

好像是因为我用的是ES6语法(箭头函数)。

但是如果我检查 http://caniuse.com/#feat=arrow-functions,它说 Chrome 确实支持箭头函数。该网站没有为 iOS 列出 Chrome,但这应该有很大的不同吗?

如果不支持箭头函数,是否也意味着我不能使用Array.map()Array.forEach()等?

Chrome for iOS has some pretty major technical restrictions imposed by the App Store, such as the requirement to use the built-in UIWebView for rendering, no V8, and a single-process model. As a result it’s been challenging to re-use critical Chromium infrastructure components. That said, there is a lot of code we do leverage, such as the network layer, the sync and bookmarks infrastructure, omnibox, metrics and crash reporting, and a growing portion of content.

来源:https://groups.google.com/a/chromium.org/forum/?fromgroups#!topic/chromium-dev/vYGxPx-tVKE

But if I check http://caniuse.com/#feat=arrow-functions, it says that Chrome does support arrow functions. The website hasn't listed Chrome for iOS, but should it make a big difference?

因此,您可能会检查是否支持您正在寻找的功能,iOS Safari 不支持 ChromeChromeiOS 中使用的渲染引擎与台式机不同。

你最好在将代码发布到生产环境之前编译你的代码,例如 babel.js。这样,您可以随心所欲地编写代码,然后以优雅降级的方式将其部署到平台。

Does it also mean that I cannot use Array.map(), Array.forEach(), etc?

Array.mapArray.forEach 来自 ES5ES5 得到广泛支持。试一试,我认为它们会起作用。