Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since May 2018.
The values() method of Array instances returns a new array iterator object that iterates the value of each item in the array.
None.
A new iterable iterator object.
Array.prototype.values() is the default implementation of Array.prototype[Symbol.iterator]().
When used on sparse arrays, the values() method iterates empty slots as if they have the value undefined.
The values() method is generic. It only expects the this value to have a length property and integer-keyed properties.
Because values() returns an iterable iterator, you can use a for...of loop to iterate it.
Because the return value is also an iterator, you can directly call its next() method.
Warning: The array iterator object should be a one-time use object. Do not reuse it.
The iterable returned from values() is not reusable. When next().done = true or currentIndex > length, the for...of loop ends, and further iterating it has no effect.
If you use a break statement to end the iteration early, the iterator can resume from the current position when continuing to iterate it.
There are no values stored in the array iterator object returned from values(); instead, it stores the address of the array used in its creation, and reads the currently visited index on each iteration. Therefore, its iteration output depends on the value stored in that index at the time of stepping. If the values in the array changed, the array iterator object's values change too.
Unlike iterative methods, the array iterator object does not save the array's length at the time of its creation, but reads it once on each iteration. Therefore, if the array grows during iteration, the iterator will visit the new elements too. This may lead to infinite loops.
values() will visit empty slots as if they are undefined.
The values() method reads the length property of this and then accesses each property whose key is a nonnegative integer less than length.
| ECMAScript® 2027 Language Specification # sec-array.prototype.values |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 20, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.