使用call继承

缺点: 只能继承属性,无法继承父类原型对象中的方法

      function Parent() {
        this.name = 'parent'
      }

      Parent.prototype.show = function () {
        console.log('show')
      }

      function Child() {
        Parent.call(this)
        this.type = 'child'
      }

      const c = new Child()

      console.log(c) // {name: "parent", type: "child"}
      c.show() // Uncaught TypeError: c.show is not a function