web api instance method
KeyboardLayoutMap: keys() method
Limited availability
The keys() method of the KeyboardLayoutMap interface returns a new Iterator object that contains the keys for each index in the KeyboardLayoutMap object.
The method is otherwise the same as keys().
Syntax
keys()
Parameters
None.
Return value
A new Iterator object.
Examples
The following example iterates every keyboard code on an English QWERTY keyboard.
navigator.keyboard.getLayoutMap().then((keyboardLayoutMap) => {
for (const code of keyboardLayoutMap.keys()) {
console.log(`${code} keyboard code`);
}
});
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.