File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ const TEMPLATE = {
7
7
Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.` ,
8
8
when : `you have to define steps of the algorithm once and let subclasses to implement its behaviour` ,
9
9
codeES5 : `function Tax() {}
10
-
11
10
Tax.prototype.calc = function(value) {
12
11
if (value >= 1000) value = this.overThousand(value);
13
12
@@ -19,16 +18,16 @@ Tax.prototype.complementaryFee = function(value) {
19
18
};
20
19
21
20
function Tax1() {}
22
- Tax1.prototype = Object.create(Tax.prototype);
21
+ Tax1.prototype = Object.create(Tax.prototype);
23
22
24
- Tax1.prototype.overThousand = function(value) {
23
+ Tax1.prototype.overThousand = function(value) {
25
24
return value * 1.1;
26
25
};
27
26
28
27
function Tax2() {}
29
- Tax2.prototype = Object.create(Tax.prototype);
28
+ Tax2.prototype = Object.create(Tax.prototype);
30
29
31
- Tax2.prototype.overThousand = function(value) {
30
+ Tax2.prototype.overThousand = function(value) {
32
31
return value * 1.2;
33
32
};
34
33
Original file line number Diff line number Diff line change @@ -20,12 +20,12 @@ function pilotDroidPattern() {
20
20
}
21
21
22
22
function B1() {}
23
- B1.prototype.info = function() {
23
+ B1.prototype.info = function() {
24
24
return 'B1, Battle Droid';
25
25
};
26
26
27
27
function Rx24() {}
28
- Rx24.prototype.info = function() {
28
+ Rx24.prototype.info = function() {
29
29
return 'Rx24, Pilot Droid';
30
30
};
31
31
You can’t perform that action at this time.
0 commit comments