【问题标题】:Is Javascript .contains() available in Babel for Node and React?Javascript .contains() 在 Babel for Node 和 React 中可用吗?
【发布时间】:2016-01-01 19:00:20
【问题描述】:

基本上是在寻找与最新 Babel 一起使用的 "jdklajsdf".indexOf('d') !== -1 的替代品。也适用于数组。

【问题讨论】:

    标签: node.js babeljs ecmascript-6


    【解决方案1】:

    是的。 String.prototype.includes 当然是 core-js(又名 babel-polyfill)。

    【讨论】:

    • 最好明确地调用函数的调用内容,而不是仅仅链接到一些文档。
    • 嗯,问题中提到的是String.prototype.contains。我认为这很明显。
    • 但不是,它是String.prototype.includes,你直接链接到它:)
    • 哦,对不起。 .contains 是 nodejs 版本。你是对的。
    猜你喜欢
    • 2015-08-26
    • 1970-01-01
    • 2018-03-06
    • 2020-05-03
    • 2017-10-22
    • 1970-01-01
    • 2019-05-24
    • 2019-11-11
    • 2017-01-04
    相关资源
    最近更新 更多