<script>
Function.prototype.method = function (name, func) {
if (!this.prototype[name]) {
This.prototype[name] = func;
}
};
Object.Method (' Superior ', function (name) {
var = this,
method = That[name];
return function () {
Return method.apply (that, arguments);
};
});
var mammal = function (spec) {
var that = {};
That.get_name = function () {
return spec.name;
};
That.says = function () {
return Spec.saying | | ‘‘;
};
return that;
};
var mymammal = mammal ({name: ' Herb '});
var cat = function (spec) {
spec.saying = Spec.saying | | ' Meow ';
var that = mammal (spec);
That.purr = function (n) {
var i, s = ';
for (i = 0; i < n; i + = 1) {
if (s) {
s + = '-';
}
s + = ' r ';
}
return s;
};
That.get_name = function () {
return that.says () + ' + Spec.name +
"+ that.says ();
}
return that;
};
var Mycat = Cat ({name: ' Henrietta '});
var Coolcat = function (spec) {
var that = Cat (spec),
Super_get_name = That.superior (' get_name ');
That.get_name = function (n) {
Return ' like ' + super_get_name () + ' baby ';
};
return that;
};
var mycoolcat = Coolcat ({name: ' Bix '});
var name = Mycoolcat.get_name ();
' Like meow Bix meow Baby '
</script>
<script>
function Createcar (numberofdoors) {
var numberofwheels = 4;
function describe () {
Return "I have" + Numberofwheels + "wheels and" + numberofdoors + "doors.";
}
return {
Describe:describe
};
}
function Createodometer () {
var mileage = 0;
function Increment (numberofmiles) {mileage + = Numberofmiles;}
Function report () {return mileage;}
return {
Increment:increment,
Report:report
}
}
function Createcarwithodometer (numberofdoors) {
var odometer = Createodometer ();
var car = Createcar (numberofdoors);
car.drive = function (numberofmiles) {
Odometer.increment (Numberofmiles);
}
Car.mileage = function () {
Return "car has driven" + odometer.report () + "Miles";
}
return car;
}
var twofn=createcarwithodometer (100);
Console.log (TWOFN);
</script>
This 2 paragraph about the JavaScript functional mode "Modular mode" of the summary, but also need to carefully ponder!!!