SHARE
TWEET

Untitled

a guest Jul 17th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class MATH {
  2.   add(a,b){
  3.     let result = +a + +b;
  4.     return result;
  5.   }
  6.  
  7.   substract(a,b){
  8.     let result = a - b;
  9.     return result;
  10.   }
  11.  
  12.   mult(a,b){
  13.     let result = a * b;
  14.     return result;
  15.   }
  16.  
  17.   div(a,b){
  18.     let result = a / b;
  19.     return result;
  20.   }
  21. }
  22.  
  23. let math = new MATH();
  24.  
  25.  
  26. calculate: function(target, room, user){
  27.         let myArray;
  28.         if(target.includes('+')){
  29.         myArray = target.split('+');
  30.         this.say(math.add(myArray[0],myArray[1]));
  31.     }
  32.        if(target.includes('-')){
  33.        myArray = target.split('-');
  34.        this.say(math.substract(myArray[0],myArray[1]));
  35.     }
  36.        if(target.includes('*')){
  37.        myArray = target.split('*');
  38.        this.say(math.mult(myArray[0],myArray[1]));
  39.     }
  40.  
  41.       if(target.includes('/')){
  42.       myArray = target.split('/');
  43.       this.say(math.div(myArray[0],myArray[1]));
  44.     }
  45.   },
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top