javascript-learner/4.5constructor/t2.js

12 lines
261 B
JavaScript
Raw Normal View History

2024-06-03 12:16:54 +02:00
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;
};
}