JavaScript Solution | Simple
Approach\n Describe your approach to solving the problem. \nWe Iterate over each letter of the string and find its ASCII character using the charCodeAt function
# Approach\n<!-- Describe your approach to solving the problem. -->\nWe Iterate over each letter of the string and find its ASCII character using the `charCodeAt` function.\nWe then subtract `s[i + 1]` from `s[i]` and then get its absolute value using `Math.abs()`.\nWe then add this value to `sum` and store the result in `sum`.\nFinally we return `sum`. \n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * @param {string} s\n * @return {number}\n */\nvar scoreOfString = function (s) {\n    let sum = 0;\n    for (let i = 0; i < s.length - 1; i++) {\n        sum += Math.abs(s.charCodeAt(i) - s.charCodeAt(i + 1));\n    }\n\n    return sum;\n};\n```
['JavaScript']