主题
keysIn
js
_.keysIn(object)
创建 object
自己的和继承的可枚举属性名称数组。
¥Creates an array of the own and inherited enumerable property names of object
.
注意:非对象值被强制转换为对象。
¥Note: Non-object values are coerced to objects.
新增于
¥Since
3.0.0
参数
¥Arguments
object
(对象):的反面;¥
object
(Object): The object to query.
返回
¥Returns
(数组):返回属性名称的数组。
¥(Array): Returns the array of property names.
示例
¥Example
js
function Foo() {
this.a = 1;
this.b = 2;
}
Foo.prototype.c = 3;
_.keysIn(new Foo);
// => ['a', 'b', 'c'] (iteration order is not guaranteed)