You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
212 B
12 lines
212 B
2 years ago
|
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;
|