Var Class = function (parent) {var klass = function () {this. init. apply (this, arguments);} if (parent) {/*** all subclasses share the same prototype * avoid creating instances when inheriting classes, only instance properties inherit * rather than class properties. Set the object's _ proto _ ***/var ctor = function () {}; ctor. prototype = parent. prototype; klass. prototype = new ctor;} klass. prototype. init = function () {}// prototype alias klass. fn = klass. prototype; // defines the class alias klass. fn. parent = klass; klass. _ super _ = klass. _ proto __; // Add the klass attribute to the class. extend = function (obj) {var extended = obj. extended; for (var I in obj) {klass [I] = obj [I];} if (extended) extended (klass);} // Add the attribute klass to the real column. include = function (obj) {var encoded DED = obj. included; for (var I in obj) {klass. fn [I] = obj [I];} // trigger the callback if (encoded) encoded ded (klass);} return klass;} var Animal = new Class; Animal. include ({breath: function () {console. log ("breath") }}) var Cat = new Class (Animal) var tommy = new Cat; console. log (tommy)