JavaScript (ES2026) reference · Array Methods

JavaScript Array values() Method

Return an iterator of the array's values, the same thing a for…of loop uses.

JavaScript (ES2026) Since ES2015

Syntax

array.values()

Return value

An array iterator.

Examples

Step through valuesTry it yourself
const it = ["a", "b"].values();
console.log(it.next(), it.next(), it.next());

Output

{ value: 'a', done: false } { value: 'b', done: false } { value: undefined, done: true }
Used by for…ofTry it yourself
for (const v of [10, 20].values()) console.log(v);

Output

10
20

Version history

VersionChange
JavaScript ES2015Added