@@ -33,7 +33,6 @@ Calculator.prototype = {
33
33
var str = this . str ;
34
34
var reg = / [ ^ 1 - 9 , 0 , * , / , \- , + , % , , ( , ) ] / g;
35
35
var result = str . match ( reg ) ;
36
- // return ;
37
36
if ( result || str . endsWith ( "+" ) || str . endsWith ( "-" ) || str . endsWith ( "*" ) || str . endsWith ( "/" ) ) {
38
37
return "Invalid: " + ( result || "End of character." ) ;
39
38
}
@@ -51,7 +50,6 @@ Calculator.prototype = {
51
50
clear : function ( ) {
52
51
this . str = 0 ;
53
52
this . updateDisplay ( ) ;
54
- // console.log(this.output());
55
53
} ,
56
54
57
55
createLayout : function ( ) {
@@ -68,7 +66,6 @@ Calculator.prototype = {
68
66
69
67
} ,
70
68
71
- //no function
72
69
createButton ( text , i ) {
73
70
var button = document . createElement ( "button" ) ;
74
71
button . innerHTML = text ;
@@ -78,7 +75,7 @@ Calculator.prototype = {
78
75
79
76
} ,
80
77
81
- buttonObserver ( a ) {
78
+ buttonObserver ( a ) {
82
79
var currentCalc = document . myCalculators [ 0 ] ;
83
80
if ( a == "C" ) {
84
81
currentCalc . clear ( ) ;
@@ -91,7 +88,7 @@ Calculator.prototype = {
91
88
}
92
89
} ,
93
90
94
- createBody ( ) {
91
+ createBody ( ) {
95
92
var cBody = document . createElement ( "div" ) ;
96
93
cBody . id = "c-body" ;
97
94
cBody . className = "c-body" ;
@@ -115,13 +112,4 @@ Calculator.prototype = {
115
112
} ;
116
113
117
114
var a = new Calculator ( "myCalculator" ) ;
118
- //sum("51 + (5 / 2 * 85 + 1)");//Invalid: End of character.
119
- //sum("5 / 2 * 85 + 1asd"); // Invalid: a,s,d
120
- //sum("5 + (5 / 2 * 85 + 1)") // 218.5
121
-
122
-
123
- //a.clear();
124
-
125
- //function sum(string) { a.input(string) }
126
-
127
115
0 commit comments