質問

The console.log return this which looks like and array : keyup charCode=0, keyCode=18 But I tried event[1] to get the keycode but it's undefined, how do I extract the keycode from this ?

function processKeyDown(event)
{
    console.log(event);
}
役に立ちましたか?

解決

this is because event is an object, not an indexed based array. use event.keyCode instead.

他のヒント

Use event.keyCode to access the key that was pressed.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top