【发布时间】:2015-09-04 15:21:10
【问题描述】:
我正在使用 Babel 编译我的 ES2015 代码。但是它不会将 find 翻译为数组。以下行抛出错误TypeError: options.find is not a function
let options = [2,23,4]
options.find(options, x => x < 10)
【问题讨论】:
-
在 babel 文档中确实提到了不完全支持它,请尝试添加 github.com/paulmillr/Array.prototype.find
-
不应该是
options.find(x => x < 10)吗?它适用于 babel repl。 -
我只在 IE11 上得到了错误。 Chrome 和 FF 工作。
标签: javascript ecmascript-6 babeljs