Ad
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);  
    }
    • function finalPrice(price,dineIn) {
    • const service = 0.05,
    • vat = 0.1;
    • const serviceCharge = dineIn ? (1+service)*(1+vat) : 1+vat;
    • 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);
    • }
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(''); 
    }
    
    • function fun(e) {
    • var 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',
    • }
    • let message = e;
    • let leetmsg = ''
    • message = message.toLowerCase();
    • for(var a of message) {
    • if (leet[a]) {
    • leetmsg += leet[a];
    • } else {
    • leetmsg += char;
    • }
    • }
    • return leetmsg
    • }
    • 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('');
    • }