class myMath {
constructor(num1, num2) {
this.num1 = num1;
this.num2 = num2;
}
getNumber() {
return [this.num1, this.num2];
}
add() {
return this.num1 + this.num2;
}
substract() {
return this.num1 - this.num2;
}
multiply() {
return this.num1 * this.num2;
}
}
// 호출하기
const test = new myMath(1, 2);
console.log(test.add());
// 3