[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/values [Back]  [Original]

Array.prototype.values() - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Array.prototype.values()

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 20185.

values() value Array Iterator

js
var a = ["w", "y", "k", "o", "p"];
var iterator = a.values();

console.log(iterator.next().value); // w
console.log(iterator.next().value); // y
console.log(iterator.next().value); // k
console.log(iterator.next().value); // o
console.log(iterator.next().value); // p

In this article

js
arr.values()

Array iterator

for...of

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

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

Specification
ECMAScript 2027 LanguageSpecification
# sec-array.prototype.values


Web Proxy Viewer  |  New URL  |  Original Page