Array.values()不起作用 [英] Array.values() does not work

查看:209
本文介绍了Array.values()不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在我的代码中使用 Array.prototype.values() 由MDN文档指定,发现它在任何代码操场中都不起作用。我直接从MDN上的示例中获取的代码。

I have been trying to use Array.prototype.values() in my code as specified by MDN documentation and found that it doesn't work in any code playground. The code I've taken directly from the examples on the MDN.

var arr = ['w', 'y', 'k', 'o', 'p'];
var iterator = arr.values();

for (let letter of iterator) {
  console.log(letter);
}

它也不能用于 repl.it ,也不在MDN自己的沙箱中。

Neither does it work in repl.it, nor in MDN's own sandbox.

I认为这是由于某些原因Node.js不支持此功能,但我在Chrome和Firefox中都尝试了控制台并得到了同样的错误。我误会了什么吗?它是一个错误吗?

I thought that this was due to this function being not supported by Node.js for some reason, but I tried the console in both Chrome and Firefox and got the same error. Am I misunderstanding something? Is it a bug?

推荐答案

通过MDN文档页面底部的浏览器兼容性表的外观,<$ c在Chrome 66和Firefox 60之前不会支持$ c> Array.prototype.values() - 两者都尚未发布!有趣的是,它目前支持 ,并且刚刚在开发人员工具中验证了我自己。

By the looks of the browser compatibility table at the bottom of the MDN documentation page, Array.prototype.values() won't be supported until Chrome 66 and Firefox 60 - neither of which have been released yet! Interestingly, it is currently supported by Safari, and have just verified that myself in the developer tools.

这篇关于Array.values()不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆