Следите за новинками
в нашем Telegram канале. Жми, чтобы подписаться:)
⊗jstsPmDSAIO 43 of 55 menu
◀ ▶

Arrays in Objects in TypeScript

Objects can contain not only primitives, but also arrays in their field values. For example, let's say we have an object with a product, containing its name and an array of available colors:

let prod: { name: string, colors: string[] };

Let's write an object of the specified structure into a variable:

prod = { name: 'notebook', colors: ['red', 'black', 'gray'] }

Make a country object that contains the page title and an array of its cities.

← →
↑
English▼
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline