Arrays & Collections
Arrays in JSON represent ordered lists of values. They're essential for handling collections of data.
Array Basics
Arrays use square brackets [] and can contain any JSON values:
["apple", "banana", "cherry"]
[1, 2, 3, 4, 5]
[true, false, true]
[{"id": 1}, {"id": 2}]
Accessing Array Elements
Arrays are zero-indexed - the first element is at index 0:
Arrays of Objects
The most common pattern - arrays containing objects:
Nested Arrays
Arrays can contain other arrays:
Exercise: Access Array Element
Exercise: Get Array Length
Exercise: Access Last Element
Key Points
- Arrays are ordered, zero-indexed collections
- Use
[index]to access elements .lengthgives you the array size- Arrays commonly contain objects
- Nested arrays use chained brackets:
arr[0][1]
التالي · الدرس 5 من 23
JSON.parse() Basics
قراءة 1 دقيقة
أنهيت 4 من 23 درسًا

اسأل Byte عن هذا الدرس
محادثة خاصة حول هذا الدرس. قرأ Byte الدرس كاملًا، ويجيب خلال ثوانٍ، ويُظهر القسم الذي تأتي منه كل إجابة. يمكنك السؤال بأي لغة.
الأسئلة والأجوبة
أسئلة عامة حول هذا الدرس. يجيب AI Tutor فورًا بلغتك، ويراجع فريق FreeAcademy الإجابات، ويمكن لكل المتعلمين قراءتها.

