Thursday, July 9, 2026
HomeLanguagesJavascriptJavaScript Intl DisplayNames() Constructor

JavaScript Intl DisplayNames() Constructor

JavaScript Intl.DisplayNames Constructor is used for creating Intl.DisplayNames object. This constructor is created using the new keyword. If we create the constructor without the new keyword it will give a TypeError

Syntax:

new Intl.DisplayNames(loc, opt)

Parameters: It has two parameters both are optional.

  • loc: It is a String or an array of Strings which allow the following value
    • nu: It specifies the numbering system to be used which can be arab, bali, latn, tibt etc.
  • opt: It is an object which can have properties like style, type, languageDisplay, fallback etc.

Returns: A DisplayNames object.

Below examples illustrate the JavaScript Intl DisplayNames() Constructor:

Example 1: In this example, we use the properties like dateTimeField and calendar/

Javascript




const example1 = new Intl.DisplayNames("en", { type: "dateTimeField" });
const example2 = new Intl.DisplayNames("fr", { type: "dateTimeField" });
const example3 = new Intl.DisplayNames("en", {type: "calendar"});
  
console.log(example1.of("year"));
console.log(example2.of("year"));
console.log(example3.of("chinese"));


Output:

year
année
Chinese Calendar

Example 2: In this example, we will use properties like Language and LanguageDisplay with the constructor.

Javascript




const example1 = new Intl.DisplayNames("en", {
    type: "language",
    languageDisplay: "dialect",
});
const example2 = new Intl.DisplayNames("fr", { 
    type: "language",
    languageDisplay: "standard",
});
console.log(example1.of("en-GB"));
console.log(example2.of("en-GB"));


Output:

British English
anglais (Royaume-Uni)

Supported Browsers:

  • Chrome
  • Edge
  • Firefox
  • Opera
  • Safari

We have a complete list of JavaScript Intl methods to check those please go through, the JavaScript Intl Reference article.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

3 COMMENTS

Most Popular

Dominic
32519 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6901 POSTS0 COMMENTS
Nicole Veronica
12017 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12111 POSTS0 COMMENTS
Shaida Kate Naidoo
7020 POSTS0 COMMENTS
Ted Musemwa
7263 POSTS0 COMMENTS
Thapelo Manthata
6978 POSTS0 COMMENTS
Umr Jansen
6968 POSTS0 COMMENTS