Нужна помощь донатом
для написания учебников Kotlin, Java, C++, C#, Go, Rust, Dart
подробности по ссылке
⊗jsPmLpAF 161 of 504 menu
◀ ▶

Filling an array in JavaScript

You can fill arrays with data in a loop. To do this, use the push method:

let arr = []; for (let i = 1; i <= 5; i++) { arr.push(i); } console.log(arr); // shows [1, 2, 3, 4, 5]

Using a loop and the push method, fill an array with numbers from 1 to 10.

Using a loop and the push method, fill an array with 10 letters 'x'.

Given an array of numbers. Loop through it and write only positive numbers into the new 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