-Annie-

FunctionalCalculator

May 27th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function calc(a, b, operator) {
  2.     "use strict";
  3.  
  4.     if (operator == '+') {
  5.         console.log(a + b);
  6.     }
  7.  
  8.     else if (operator == '-') {
  9.         console.log(a - b);
  10.     }
  11.  
  12.     else if (operator == '/') {
  13.         console.log(a / b);
  14.     }
  15.    
  16.     else if (operator == '*') {
  17.         console.log(a * b);
  18.     }
  19. }
Add Comment
Please, Sign In to add comment