Sogrey / Web-QA

https://sogrey.github.io/Web-QA/
MIT License
6 stars 2 forks source link

Object.create的基本实现原理 #324

Open Sogrey opened 3 years ago

Sogrey commented 3 years ago

思路:将传入的对象作为原型

function create(obj) {
  function F() {}
  F.prototype = obj
  return new F()
}