12 lines
212 B
TypeScript
12 lines
212 B
TypeScript
const sumstring = (value: string): number => {
|
|
let sum = 0;
|
|
|
|
for (let index = 0; index < value.length; index += 1) {
|
|
sum += value.codePointAt(index) || 0;
|
|
}
|
|
|
|
return sum;
|
|
};
|
|
|
|
export default sumstring;
|