Does some JavaScript library use dynamic aspects of the prototype system?

前端 未结 3 1783
醉梦人生
醉梦人生 2020-12-12 03:32

JavaScript object created with a prototype maintains \"live\" connection to its prototype, so that changing the prototype also affects the objects created from it.

T

3条回答
  •  不思量自难忘°
    2020-12-12 04:25

    This dynamism is present in polyfill libraries that patch older browsers, e.g. by adding Array.prototype.map, or add upcoming new features from ES6, e.g. Array.prototype.find. See https://github.com/paulmillr/es6-shim/ for an example.

提交回复
热议问题