create
最后更新于:2022-04-02 00:04:40
## create
+ [link](./create "Link to this entry.")
+ [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L10856 "View in source.")
+ [npm](https://www.npmjs.com/package/lodash.create "See the npm package.")
```
_.create(prototype, [properties])
```
创建一个继承 `prototype` 的对象。 如果提供了 `properties`,它的可枚举属性会被分配到创建的对象上。
### 参数
1. prototype (Object)
要继承的对象
2. [properties] (Object)
待分配的属性
### 返回值 (Object)
返回新对象
### 示例
```
function Shape() {
this.x = 0;
this.y = 0;
}
function Circle() {
Shape.call(this);
}
Circle.prototype = _.create(Shape.prototype, {
'constructor': Circle
});
var circle = new Circle;
circle instanceof Circle;
// => true
circle instanceof Shape;
// => true
```
';