This comes out as undefined. Why is this?
var possibleKeyCodes = [ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90 ];
console.log(possibleKeyCodes[0].key);
I expected it to give me a key name as a string. It just gave me an undefined.
>Solution :
var possibleKeyCodes = [ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90 ];
console.log(possibleKeyCodes[0].key);
Your array is an array of numbers. You are trying to treat an element of this array as it is an object with key property
If you need the ascii repreentation of that number you can do it like that
console.log(String.fromCharCode(possibleKeyCodes[0]))
Or as a snippet
var possibleKeyCodes = [ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90 ];
console.log(String.fromCharCode(possibleKeyCodes[0]))