Skip to content

Instantly share code, notes, and snippets.

@mrded
Created November 25, 2014 10:29
Show Gist options
  • Save mrded/2e7c4d8198484787b14c to your computer and use it in GitHub Desktop.
Save mrded/2e7c4d8198484787b14c to your computer and use it in GitHub Desktop.
JavaScript: Get numeric keys.
var array = {
0: 'foo',
1: 'bar',
baz: 'ignore'
};
var keys = Object.keys(array).filter(function(key) {
return !isNaN(key); // Is numeric.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment