How best to inherit from native JavaScript object? (Especially String)

后端 未结 4 2045
北恋
北恋 2021-02-12 18:01

I\'m a long-time browser but a first time participator. If I\'m missing any etiquette details, please just let me know!

Also, I\'ve searched high and low, including this

4条回答
  •  萌比男神i
    2021-02-12 18:36

    You can't assign the this in a constructor

    this=n is an error

    Your myarray is just an alias for the native Array- any changes you make to myarray.prototype are changes to Array.prototype.

提交回复
热议问题