静修-个人博客


  • 首页

  • 分类

  • 归档

  • 标签

  • 搜索

97-Object.create

发表于 2019-08-31 | 分类于 前端-02-js基础复习 |

object.create() 是使用指定的原型proto对象及其属性propertiesObject去创建一个新的对象。

1
2
3
4
5
6
7
8
9
10
Object.myCreate = function (obj, properties)  {
var F = function () {}
F.prototype = obj
if (properties) {
Object.defineProperties(F, properties)
}
return new F()
}

Object.myCreate({}, {a: {value: 1}}) // {a: 1}

前端-02-js基础复习
37-vscode配置stylelint
14-个人前端常用工具软件
静修

静修

322 日志
19 分类
19 标签
© 2019 静修
本站访客数:
由 Hexo 强力驱动
主题 - NexT.Pisces