Skip to content

values

js
_.values(object)

创建 object 自身可枚举字符串键控属性值的数组。

¥Creates an array of the own enumerable string keyed property values of object.

注意:非对象值被强制转换为对象。

¥Note: Non-object values are coerced to objects.

新增于

¥Since

0.1.0

参数

¥Arguments

  1. object (对象):的反面;

    ¥object (Object): The object to query.

返回

¥Returns

(数组):返回属性值的数组。

¥(Array): Returns the array of property values.

示例

¥Example

js
function Foo() {
  this.a = 1;
  this.b = 2;
}

Foo.prototype.c = 3;

_.values(new Foo);
// => [1, 2] (iteration order is not guaranteed)

_.values('hi');
// => ['h', 'i']

Lodash v4.17 中文网 - 粤ICP备13048890号