The Love-Letter Mystery

  • + 0 comments

    JS:

    function theLoveLetterMystery(s) {
        // Write your code here
        
            let count=0;
            let c=0;
            let d=s.length-1;
            while(c<d){
                 let k=s.charCodeAt(c);
                 let l=s.charCodeAt(d); 
                count+=Math.abs(l-k); 
                c++;
                d--;
            }        
            return count;
    }