Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/static/patterns/behavioral_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
};

Expand Down
4 changes: 2 additions & 2 deletions src/static/patterns/creational_abstractFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
};

Expand Down