Code
Diff
  • function finalPrice(price, dineIn) {
      // These were always used as a coefficients, no point in calculating 1 + tax every run 
      const serviceModifier = 1.05,
            vatModifier = 1.1;
      const serviceCharge = dineIn ? serviceModifier * vatModifier : vatModifier;
      return Math.floor(price * serviceCharge);  
    }
  • 1
    function finalPrice(price,dineIn) {
    
    2
      const service = 0.05,
    
    3
            vat = 0.1;
    
    4
      
    
    5
      const serviceCharge = dineIn ? (1+service)*(1+vat) : 1+vat;
    
    1+
    function finalPrice(price, dineIn) {
    
    2+
      // These were always used as a coefficients, no point in calculating 1 + tax every run 
    
    3+
      const serviceModifier = 1.05,
    
    4+
            vatModifier = 1.1;
    
    5+
      const serviceCharge = dineIn ? serviceModifier * vatModifier : vatModifier;
    
    66
      return Math.floor(price * serviceCharge);  
    
    77
    }
    
Code
Diff
  • function fun(message) {
        const leet = {
            a: '@',
            b: '8',
            c: '(',
            d: '|)',
            e: '3',
            f: '|=',
            g: '6',
            h: '#',
            i: '!',
            j: ']',
            k: '|{',
            l: '1',
            m: 'em',
            n: '[\]',
            o: '0',
            p: '|*',
            q: '0,',
            r: '|2',
            s: '$',
            t: '7',
            u: '(_)',
            v: '\/',
            w: 'vv',
            x: '%',
            y: '`/',
            z: '2',
        }
       
        return message.toLowerCase().split('').map(s => leet[s] || s).join(''); 
    }
    
  • 1
    function fun(e) {
    
    2
            var leet = {
    
    3
              a: '@',
    
    4
               b: '8',
    
    5
               c: '(',
    
    6
               d: '|)',
    
    7
               e: '3',
    
    8
               f: '|=',
    
    9
               g: '6',
    
    10
               h: '#',
    
    11
               i: '!',
    
    12
               j: ']',
    
    13
               k: '|{',
    
    14
               l: '1',
    
    15
               m: 'em',
    
    16
               n: '[\]',
    
    17
               o: '0',
    
    18
               p: '|*',
    
    19
               q: '0,',
    
    20
               r: '|2',
    
    21
               s: '$',
    
    22
               t: '7',
    
    23
               u: '(_)',
    
    24
               v: '\/',
    
    25
               w: 'vv',
    
    26
               x: '%',
    
    27
               y: '`/',
    
    28
               z: '2',
    
    29
          }
    
    30
          
    
    31
          let message = e;
    
    32
          let leetmsg = ''
    
    33
          
    
    34
          message = message.toLowerCase();
    
    35
          for(var a of message) {
    
    36
              if (leet[a]) {
    
    37
                  leetmsg += leet[a];
    
    38
              } else {
    
    39
                  leetmsg += char;
    
    40
              }
    
    41
          }
    
    42
         return leetmsg 
    
    43
    1+
    function fun(message) {
    
    2+
        const leet = {
    
    3+
            a: '@',
    
    4+
            b: '8',
    
    5+
            c: '(',
    
    6+
            d: '|)',
    
    7+
            e: '3',
    
    8+
            f: '|=',
    
    9+
            g: '6',
    
    10+
            h: '#',
    
    11+
            i: '!',
    
    12+
            j: ']',
    
    13+
            k: '|{',
    
    14+
            l: '1',
    
    15+
            m: 'em',
    
    16+
            n: '[\]',
    
    17+
            o: '0',
    
    18+
            p: '|*',
    
    19+
            q: '0,',
    
    20+
            r: '|2',
    
    21+
            s: '$',
    
    22+
            t: '7',
    
    23+
            u: '(_)',
    
    24+
            v: '\/',
    
    25+
            w: 'vv',
    
    26+
            x: '%',
    
    27+
            y: '`/',
    
    28+
            z: '2',
    
    29+
        }
    
    30+
       
    
    31+
        return message.toLowerCase().split('').map(s => leet[s] || s).join(''); 
    
    4444
    }