Back to Content

KeyboardLayoutMap: values() method

files/en-us/web/api/keyboardlayoutmap/values/index.md

latest944 B
Original Source

{{SeeCompatTable}}{{APIRef("Keyboard API")}}

The values() method of the {{domxref("KeyboardLayoutMap")}} interface returns a new Iterator object that contains the values for each index in the KeyboardLayoutMap object.

The method is otherwise the same as {{jsxref("Map.prototype.values()")}}.

Syntax

js-nolint
values()

Parameters

None.

Return value

A new Iterator object.

Examples

The following example iterates every location- or layout-specific string on an English QWERTY keyboard.

js
navigator.keyboard.getLayoutMap().then((keyboardLayoutMap) => {
  for (const key of keyboardLayoutMap.values()) {
    console.log(`${key} key`);
  }
});

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{jsxref("Map.prototype.values()")}}