Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(num1, num2, operator) {
- const operations = {
- 'multiply': num1 * num2,
- 'divide': num1 / num2,
- 'add': num1 + num2,
- 'subtract': num1 - num2
- }
- console.log(operations[operator])
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement