JavaScript Inheritance and Hoisting
问题 In my current web project, I'm working with multiple JavaScript files, each containing type definitions that inherit from other types. So in any given file, I could have something like ... function Type(){ ParentType.call(this); } Type.prototype = Object.create( ParentType.prototype ); Type.prototype.constructor = Type; ... with the ParentType declared similarly in another file: function ParentType(){ this.data = ""; } Since working with many JavaScript files becomes bothersome in the <head>