unset
最后更新于:2022-04-02 00:05:55
## unset
+ [link](./unset "Link to this entry.")
+ [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L11828 "View in source.")
+ [npm](https://www.npmjs.com/package/lodash.unset "See the npm package.")
```
_.unset(object, path)
```
移除对象路径的属性。 **注意:** 这个方法会改变源对象
### 参数
1. object (Object)
要修改的对象
2. path (Array|string)
要移除的对象路径
### 返回值 (boolean)
移除成功返回 `true`,否则返回 `false`
### 示例
```
var object = { 'a': [{ 'b': { 'c': 7 } }] };
_.unset(object, 'a[0].b.c');
// => true
console.log(object);
// => { 'a': [{ 'b': {} }] };
_.unset(object, 'a[0].b.c');
// => true
console.log(object);
// => { 'a': [{ 'b': {} }] };
```
';