Different scopes have different execution environments. This means that they have different built-ins
(different global object, different constructors, etc.). This may result in unexpected results. For instance,
[] instanceof window.frames[0].Array
will return false
, because Array.prototype !== window.frames[0].Array
and arrays inherit from the former.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
Note: just add another check if the current event.type
checking is insufficient.
Determine the actual printable character that is generated from a pressed key.
If the key does not correspond to a printable character, undefined
is returned.
The result may be altered by modifier keys.
Determine the pressed key of a keyboard event. This key should correspond to the physical key according
to a standard US keyboard layout. International keyboard layouts are handled by KeyboardLayoutService
.
keyIdentifier
is used to access this deprecated field:
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyIdentifier
Determines a
true
offalse
value for the key code argument.