Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(inp) {
- let start = inp.shift().charCodeAt();
- let end = inp.shift().charCodeAt();
- let i = start + 1;
- let sum = 0;
- let str = '';
- while (i <= end - 1) {
- let curChar = String.fromCharCode(i);
- str += curChar;
- i++;
- }
- sum = str.split('').reduce((acc, el) => acc + el.charCodeAt(), 0);
- console.log(str, sum);
- }
- solve(
- [
- '?',
- 'E',
- '@ABCEF'
- ]
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement