en.javascript.info/1-js/4-object-basics/04-object-methods/7-calculator/solution.md
Ilya Kantor 3defacc09d up
2016-11-12 19:38:58 +03:00

283 B

let calculator = {
  sum() {
    return this.a + this.b;
  },

  mul() {
    return this.a * this.b;
  },

  read() {
    this.a = +prompt('a?', 0);
    this.b = +prompt('b?', 0);
  }
};

calculator.read();
alert( calculator.sum() );
alert( calculator.mul() );