JS: Array.prototype.values
New in JS2015.
arrayX.values()
- Return a Iterator (also is a Iterable Object), each entry is the element's value of the array.
Note: this method is not useful, because array itself is a iterable already.
as of 2018-01-01 Array.prototype.values is not supported by Google Chrome, Firefox. It's supported in both as of 2019-10-31.
for (const e of ["a", "b", "c"].values()) { console.log( e ); } // prints // a // b // c
Array.prototype[Symbol.iterator]
Array.prototype.values
is identical to
Array.prototype[Symbol.iterator]
console.log( Array.prototype.values === Array.prototype [ Symbol.iterator ] ); // true