'Is there a way to add two values of an array?

I am trying to make a vernam cypher using html and js, I started by giving each letter a value like (a = 0, b = 1, c = 2, … z = 25). Made two inputs so user can enter the world, and the key. Next I transformed the string from the input to an array, using Array.from(). But now I can't add the values to each others, I cannot find the right loop for it. This is a link that says what is vernam cypher so you can understand what I am trying to do: https://www.geeksforgeeks.org/vernam-cipher-in-cryptography/



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source