Web development
Arrays and Loops
Updated Oct 28, 2026
An array stores an ordered collection. Array positions start at zero, so the first item is at index 0. A loop repeats work; for...of reads each value of an array. Make sure the data you process has th
What you’ll learn
Understand and practise arrays and loops.
Explanation
An array stores an ordered collection. Array positions start at zero, so the first item is at index 0. A loop repeats work; for...of reads each value of an array. Make sure the data you process has the expected type.
Array រក្សាទុកបញ្ជីដែលមានលំដាប់។ លេខទីតាំងចាប់ផ្ដើមពី 0។ Loop ប្រើធ្វើសកម្មភាពម្ដងទៀតសម្រាប់ធាតុនីមួយៗ។
Example
const fruits = ["mango", "banana"]; for (const fruit of fruits) { console.log(fruit); }
Practice
What is fruits[0]?
Answer and explanation
Show answer / បង្ហាញចម្លើយ
"mango". Array indexing starts at zero.
Quick recap
An array stores an ordered collection.