JavaScript keys()Method

Array 对象参考手册JavaScript Array Object

Example

Create an array iterator object from the array fruit, which contains the keys of the array:

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

Try it Yourself »

Definition and Usage

The keys() method is used to create an iterable object from an array that contains the keys of the array.

Returns true if the object is an array, otherwise returns false.


Browser Support

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

Method
keys() 38.0 12.0 28.0 8 25.0

Syntax

array.keys()

Parameters

No parameters.

Technical Details

Return Value: An array iterable object.
JavaScript Version: ECMAScript 6


Array 对象参考手册JavaScript Array Object

Other Extensions