This is an experimental technology, part of the Harmony (ECMAScript 6) proposal.
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future version of browsers as the spec changes.


The keys() method returns a new Array Iterator that contains the keys for each index in the array.




var arr = ["a","b","c"];
var eArr = arr.keys();

console.log(; // 0
console.log(; // 1
console.log(; // 2


Specification Status Comment
ECMAScript Language Specification 6th Edition (ECMA-262) Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes)[1] 28 (28) Not supported Not supported Not supported
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support Not supported Not supported 28.0 (28) Not supported Not supported Not supported


[1] The feature is available behind a preference. Go to chrome://flags and activate the entry “Enable Experimental JavaScript”.

See also

Document Tags and Contributors

Contributors to this page: vladikoff, fscholz, rvighne
Last updated by: rvighne,
Hide Sidebar