back to Overview

_.keys()

Creates a Minified list containing all property names of the specified object.
Util module only.

Syntax

_.keys(obj)

Parameters

object
The object to gather keys from.
(return value)
A Minified list containing the property names.

Description

Creates a Minified list containing all property names of the specified object. Only direct properies are included, not inherited ones. The order of the keys in the list is undefined and runtime-specific.

Example

Using keys():

var obj = {a: 2, b: 52};
var keys = _.keys(obj);  // keys contains ['a', 'b'] now

See also..

  • _.values() returns the values of an object as a list.

Comments

comments powered by Disqus

back to Overview

Functions