Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let input = ['5', 'telerik', 'alpha', 'java', 'Spring', 'nodeJS', 'Output'];
- let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
- let print = this.print || console.log;
- let n = gets();
- for (let i = 0; i < n; i++) {
- let word = gets();
- let weight = word.toLowerCase().split('').
- reduce((acc, curr) => acc + curr.charCodeAt(0) - 96, 0);
- print(`${weight} ${word}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement