There is a table like the table of Pythagoras.
If you know the number / letter from the column (left) and the number from the line (above), then how do you know the number / letter standing at the intersection in the table?

  • Matrix two-dimensional? - user207618
  • Didn't understand the question a lot? but it’s not three dimensional ... - octopus
  • Certainly not 3D, that's why 2D said. - user207618
  • 2
    I told you how. Arrays and coordinates. - user207618
  • one
    Not at all, proportional to the table. - user207618

3 answers 3

Without using a matrix because of the pattern in the arrangement of letters in the table:

function getLetter(left, up) { var number = fromHex(up) * 16 + fromHex(left); var letterCode = 32; if (number >= 2 && number <= 27) { letterCode = number + 63; } else if (number >= 28 && number <= 37) { letterCode = number + 20; } else if (number >= 38 && number <= 63) { letterCode = number + 59; } return String.fromCharCode(letterCode); } function fromHex(char) { return parseInt(char + "", 16); } var letter = getLetter('C', '2'); console.log(letter); 

  • Thanks, helped ... - octopus
  • Sorry for the intrusiveness, how to get the coordinates from the input ... jsfiddle.net/1a8xjaue/1 where is the error - octopus
  • @octopus in a good way, it was worth asking a separate question. You would then get an answer faster. But in general - something like that . - Regent
  • Understood, thank you .... bad question - why go of input and not class? I never thought that there is a connection of priorities ... -
 // Первое значение — ось Y, второе — X, var out = getItem('b', '0') console.log(out) // "J" function getItem(y, x) { // Тут переводим шестнадцатиричное число // в десятиричное, если требуется var args = arguments for(var i = 0; i < args.length; i++) { if(typeof args[i] === 'string') { args[i] = parseInt(args[i], 16) } } // Возвращаем ячейку по координатам return [ //0, 1, 2, 3 [ , 'O', '4', 'k'], // 0 [ , 'P', '5', 'l'], // 1 ['A', 'Q', '6', 'm'], // 2 ['B', 'R', '7', 'n'], // 3 ['C', 'S', '8', 'o'], // 4 ['D', 'T', '9', 'p'], // 5 ['E', 'U', 'a', 'q'], // 6 ['F', 'V', 'b', 'r'], // 7 ['G', 'W', 'c', 's'], // 8 ['H', 'X', 'd', 't'], // 9 ['I', 'Y', 'e', 'u'], // a ['J', 'Z', 'f', 'v'], // b ['K', '0', 'g', 'w'], // c ['L', '1', 'h', 'x'], // d ['M', '2', 'i', 'y'], // e ['N', '3', 'j', 'z'], // f ][y][x] } 
  • Close, but the first comparison should be on Y - octopus
  • You can change in the attributes x and y places - Vasya Shmarovoz

You can tailor it to your decision, where there will be numbers and capital, small letters. I hope that helped

 var alphabet = "abcdefghijklmnopqrstuvwxyz".split(""); _.each(alphabet, function(letter) { console.log(letter); });