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

Array length in JavaScript

The length of an array is found using the property length:

let arr = ['a', 'b', 'c']; console.log(arr.length) // shows 3

If you know the length of an array, you can get its last element:

let arr = ['a', 'b', 'c']; console.log(arr[arr.length - 1]) // shows 'c'

Create an array with arbitrary elements. Display on the screen the number of elements in this array.

Create an array with arbitrary elements. Display the last element of this array.

← →
↑
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