- script.js
JavaScript
// Alphabet
var symbols = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ' ', '.', ',', '-', '!', '’'];
// Encoded message
var encodedMessage = [18, 30, 47, 30, 39, 52, 38, 30, 26, 37, 44, 52, 26, 39, 29, 52, 40, 39, 30, 52, 39, 26, 41, 52, 31, 40, 43, 52, 32, 40, 40, 29, 52, 38, 30, 26, 44, 46, 43, 30, 53];
// Decoded message
var decodedMessage = '';
/* Technical assignment
Meow! I learned how to encrypt and I need a decryption program.
There is a symbols array where the alphabet (letters and other symbols) is stored.
There is an array encodedMessagewhere where an encrypted message is stored. Each element of this array is a symbol index from the symbols array.
The decryption program must translate elements from the array with encryption (encodedMessage) into characters from the alphabet array (symbols) and glue them into a decoded string. Write this line into the variable decodedMessage.
*/