JavaScript Array keys() Method
THE WORLD'S LARGEST WEB DEVELOPER SITE

JavaScript Array keys() Method

❮ JavaScript Array Reference

Example

Create an Array Iterator object, with keys for each item in the fruit array:

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.keys();
Try it Yourself »

Definition and Usage

The keys() method returns an Array Iterator object with the keys of an array.


Browser Support

The numbers in the table specify the first browser version that fully supports the method.

Method
keys() 38.0 12.0 28.0 8 25.0

Syntax

array.keys()

Parameter Values

No parameters.

Technical Details

Return Value: An Array Iterator object
JavaScript Version: ECMAScript 6

❮ JavaScript Array Reference