Favorites

JavaScript Array.prototype.values() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Array.prototype.values()
JavaScript Array Instance methodThis method is supported by all modern browsers.
Updated 28th November 2026

The values() method returns an iterator over the elements of an array.

Description

The values() method returns an iterator of the array's elements. It's what for...of uses behind the scenes for arrays. It's useful when an API expects an iterator, or with iterator helpers such as take() and drop(), which process values lazily.

Calling values() is equivalent to arr[Symbol.iterator](), the same iterator for...of and spread syntax use. Like all iterators, the result can only be consumed once: after looping through it, it's exhausted, and you need to call values() again for a fresh one.

The iterator is live: if elements are added to or changed in the array before the iterator reaches them, it sees the new values. Empty slots in sparse arrays produce undefined. Maps and sets have their own values() methods, and Object.values() does the same job for objects.

Syntax

array.values()

Return Value

A new array iterator that yields each element.

Example

const it = ['a', 'b', 'c'].values();
console.log(it.next().value);
console.log([...it]);
console.log([1, 2, 3, 4].values().drop(1).take(2).toArray());

Browser Support

The following information will show you the current browser support for the Array.prototype.values() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee