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

Delete operator in arrays in JavaScript

You can delete array elements using the delete operator. Let's look at examples. Let's say we have an array like this:

let arr = ['a', 'b', 'c'];

Let's delete one of the elements of our array:

delete arr[1];

As a result, the element will be deleted, but the array will become sparse:

console.log(arr); // shows ['a',, 'c']

Given an array:

let arr = ['a', 'b', 'c', 'd', 'e'];

Delete two elements from it. Check the value of the property length after that.

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