0
введите сюда код

let calculator = {

  Num() {
     this.num1 = +prompt("Введите число");
     this.num2 = +prompt("Введите число");
  },

  Input() {
    this.plus = document.getElementById('plus');
    this.minus = document.getElementById('minus');
    this.multiply = document.getElementById('multiply');
    this.devide = document.getElementById('devide');
  },

  NumberOperation() {
    this.plus.addEventListener("click", this.NumPlus);
  },

  NumPlus() {
    let result = this.num1 + this.num2;
    alert(result);
  },

};

calculator.Num()
calculator.Input();
calculator.NumberOperation();
calculator.NumPlus();
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript" src="main.js"></script>
    <meta charset="utf-8">
</head>
<body>

    <button id="plus">+</button>
    <button id="minus">-</button>
    <button id="multiply">*</button>
    <button id="devide">/</button>

</body>
</html>

2

0

Посмотрите другие вопросы с метками или задайте свой вопрос.