⊗jsPmArEPA 76 of 504 menu

Adding elements using "push" in JavaScript

Using the special method push, you can add elements to the end of an array. Let's see how it's done. Let's say we have the following array:

let arr = [];

Add three elements to its end:

arr.push('a'); arr.push('b'); arr.push('c');

Let's see what happened:

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

Fill an array with numbers 1, 2 and 3.

Let such an array be given:

let arr = [1, 2, 3];

Add the elements 4 and 5 to its end.

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