ES6 Array.prototype.values现在不应该存在吗? [英] ES6 Array.prototype.values shouldn't it exist by now?

查看:75
本文介绍了ES6 Array.prototype.values现在不应该存在吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在不应该存在ES6 Array.protoype.values ,因为这已经有效:

Shouldn't ES6 Array.protoype.values exist already by now since this already works:

Array.prototype.values = function(){
  return this[Symbol.iterator]();
}

let arr = [1,2,3,4,5];
let iterator = arr.values();

for(let num of iterator) console.log(num) // 1, 2, 3, 4, 5


推荐答案

它打破了太多网站,因此被删除了。这些是需要关注的两个相关问题:

It breaks too many sites, so it was removed. These are the two relevant issues to keep an eye on:

  • https://code.google.com/p/chromium/issues/detail?id=462936
  • https://bugzilla.mozilla.org/show_bug.cgi?id=875433

据我所知,没有ETA。

There's no ETA as far as I've gathered.

这篇关于ES6 Array.prototype.values现在不应该存在吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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