I am with an exercise that is eating my head.
1st - I have an object with different arrays inside.
2nd - I create a function that you pass a word as a parameter
3rd - The output must be the position of the key of each letter of the word
var dictionary = {
0: ['A', 'K', 'T', 'F', 'O', 'Y'],
1: ['B', 'L', 'U', 'G', 'P', 'Z'],
2: ['C', 'M', 'V', 'H', 'Q', '.'],
3: ['D', 'N', 'W', 'I', 'R', ','],
4: ['E', 'Ñ', 'X', 'J', 'S', ' ']
}
From the word HELLO its output would be 2010
Each number would be the position of the key
I am not looking for the solution or the entire code. Just understand how I should approach the code and steps to follow, but no code.
Thank you very much!
Simple: iterate through the searched word; for each letter, you will iterate through the object, and, for each element, you check if it contains the searched letter or not: