Skip to content

Latest commit

 

History

History
60 lines (37 loc) · 2.39 KB

File metadata and controls

60 lines (37 loc) · 2.39 KB
title slug
Intl.DisplayNames.prototype.of()
Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of

{{JSRef}}

Intl.DisplayNames.prototype.of() メソッドは、コードを受け取り、Intl.DisplayNames をインスタンス化するときに指定されたロケールとオプションに基づいて文字列を返します。

{{EmbedInteractiveExample("pages/js/intl-displaynames.html")}}

構文

of(code);

引数

返値

その言語における書式化された文字列です。

of メソッドの使用

let regionNames = new Intl.DisplayNames(["en"], { type: "region" });
regionNames.of("419"); // "Latin America"

let languageNames = new Intl.DisplayNames(["en"], { type: "language" });
languageNames.of("fr"); // "French"

let currencyNames = new Intl.DisplayNames(["en"], { type: "currency" });
currencyNames.of("EUR"); // "Euro"

仕様書

{{Specifications}}

ブラウザーの互換性

{{Compat}}

関連情報

  • {{jsxref("Intl.DisplayNames")}}