constructor is a function
This commit is contained in:
12
4.5constructor/t2.js
Normal file
12
4.5constructor/t2.js
Normal file
@@ -0,0 +1,12 @@
|
||||
function Calculator(){
|
||||
this.read = function(){
|
||||
this.a = +prompt('a?', 0);
|
||||
this.b = +prompt('b?', 0);
|
||||
};
|
||||
this.sum = function(){
|
||||
return this.a + this.b;
|
||||
};
|
||||
this.mul = function(){
|
||||
return this.a * this.b;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user