gpt4 book ai didi

javascript - IE11/Windows 10 => 对象不支持属性或方法 'includes'

转载 作者:行者123 更新时间:2023-11-30 21:02:54 25 4
gpt4 key购买 nike

在 Windows 10 上的 IE11 中,我收到 Object doesn't support property or method 'includes' 错误 on Cookie.set('something', null)。以前我有 Cookie.remove('something') 并且给出了同样的错误。

  Cookie = require('js-cookie')
Cookies.set('save_lead', null)
// used to be:
// Cookies.remove('save_lead')

enter image description here enter image description here

最佳答案

我使用 array-includes 找到了解决方案npm 包。乍一看,它似乎只是为您提供了调用 arr.includes('foo') 的替代方法,但它也允许使用 shim。

来自 github 自述文件:

var includes = require('array-includes');
var assert = require('assert');
/* when Array#includes is not present */
delete Array.prototype.includes;
var shimmedIncludes = includes.shim();

assert.equal(shimmedIncludes, includes.getPolyfill());
assert.deepEqual(arr.includes('foo', 1), includes(arr, 'foo', 1));

希望对其他人有帮助。

关于javascript - IE11/Windows 10 => 对象不支持属性或方法 'includes',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46944403/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com