4.4 task
<script>
"use strict"
<script>
"use strict"
let calculator = {
// input1 : 0,
// input2 : 0,
//do not need new value definition
//such an amazing language it is...!!!
read() {
this.input1 = +prompt('Input first operand', );
this.input2 = +prompt("Input second operand", );
/////////////to make the input to be INTEGER WE NEED THIS +
// input1 : 0,
// input2 : 0,
//do not need new value definition
//such an amazing language it is...!!!
read() {
this.input1 = +prompt('Input first operand', );
this.input2 = +prompt("Input second operand", );
/////////////to make the input to be INTEGER WE NEED THIS +
},
sum(){
return this.input1 + this.input2;
},
return this.input1 + this.input2;
},
mul(){
return this.input1 * this.input2;
},
return this.input1 * this.input2;
},
};
calculator.read();
alert(calculator.sum() );
alert(calculator.mul() );
alert(calculator.sum() );
alert(calculator.mul() );
</script>
댓글
댓글 쓰기