Advertisement
Onesible

Untitled

Mar 4th, 2025
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(num1, num2, operator) {
  2.     const operations = {
  3.         'multiply': num1 * num2,
  4.         'divide': num1 / num2,
  5.         'add': num1 + num2,
  6.         'subtract': num1 - num2
  7.     }
  8.    
  9.     console.log(operations[operator])
  10. }
  11.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement