diff --git a/src/static/patterns/behavioral_template.js b/src/static/patterns/behavioral_template.js index e4ebcb0..b6d48a0 100644 --- a/src/static/patterns/behavioral_template.js +++ b/src/static/patterns/behavioral_template.js @@ -7,7 +7,6 @@ const TEMPLATE = { Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.`, when: `you have to define steps of the algorithm once and let subclasses to implement its behaviour`, codeES5: `function Tax() {} - Tax.prototype.calc = function(value) { if (value >= 1000) value = this.overThousand(value); @@ -19,16 +18,16 @@ Tax.prototype.complementaryFee = function(value) { }; function Tax1() {} - Tax1.prototype = Object.create(Tax.prototype); +Tax1.prototype = Object.create(Tax.prototype); - Tax1.prototype.overThousand = function(value) { +Tax1.prototype.overThousand = function(value) { return value * 1.1; }; function Tax2() {} - Tax2.prototype = Object.create(Tax.prototype); +Tax2.prototype = Object.create(Tax.prototype); - Tax2.prototype.overThousand = function(value) { +Tax2.prototype.overThousand = function(value) { return value * 1.2; }; diff --git a/src/static/patterns/creational_abstractFactory.js b/src/static/patterns/creational_abstractFactory.js index 96ceaba..057b9c8 100644 --- a/src/static/patterns/creational_abstractFactory.js +++ b/src/static/patterns/creational_abstractFactory.js @@ -20,12 +20,12 @@ function pilotDroidPattern() { } function B1() {} - B1.prototype.info = function() { +B1.prototype.info = function() { return 'B1, Battle Droid'; }; function Rx24() {} - Rx24.prototype.info = function() { +Rx24.prototype.info = function() { return 'Rx24, Pilot Droid'; };