Advertisement
Spocoman

05. Simple Calculator

Jan 25th, 2022
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (a, b, operator) {
  2.  
  3.     let operators = {'multiply': a * b , 'divide': a / b, 'add': a + b, 'subtract': a - b};
  4.  
  5.     console.log(operators[operator]);
  6.  
  7. }
  8.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement