Simple OOP Calculator

Published by meesie1 in

Create functions for the Calculator class that can do the following:

  • Add two numbers.
  • Subtract two numbers.
  • Multiply two numbers.
  • Divide two numbers.

Examples

var calculator = new Calculator()

calculator.add(10, 5) ➞ 15

calculator.subtract(10, 5) ➞ 5

calculator.multiply(10, 5) ➞ 50

calculator.divide(10, 5) ➞ 2

Notes

The functions should return the result of the calculation.

Watch a quick demo on how Edabit works.