【文件属性】:
文件名称:inherit.js:正确使用原型继承和链接的简单方法
文件大小:5KB
文件格式:ZIP
更新时间:2021-07-05 15:42:50
JavaScript
继承.js
inherit.js 是一种在 JavaScript 中正确使用原型链的简单方法。 通常,为了使事情简单,只使用 1 级原型链,因为多级原型链。 这个库使得在原型链中使用任意数量的级别变得非常容易,这有助于保持代码。
用法
inherit ( childConstructor , parentConstructor )
例子
代码
function Grandfather ( ) { }
Grandfather . prototype . getName = function ( ) { return 'John Doe I' ; } ;
function Father ( ) { }
Father . prototype . getName = function ( ) { return 'John Doe II' ; } ;
inherit ( Father , Gr
【文件预览】:
inherit.js-master
----.gitignore(168B)
----package.json(651B)
----src()
--------inherit.js(3KB)
----LICENSE.md(1KB)
----Gruntfile.js(671B)
----dist()
--------inherit.min.js(1007B)
----README.md(1KB)
----.gitattributes(435B)