Array Array Object
Last updated: 2026-09-09
Array Array Object
Array is JavaScript's built-in array object: a constructor for ordered lists with 30+ methods for adding, removing, searching, iterating and transforming. Arrays are untyped — any mix of values is allowed and length is maintained automatically.
| Category | Arrays |
|---|---|
| ES version | ES1 (1997) |
📝 Syntax
const arr = [1, 2, 3]; // literal (preferred)
const arr = new Array(3); // [empty × 3] careful
const arr = new Array(1, 2, 3); // [1, 2, 3]
Array.isArray(arr); // true
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
3
[ 10, 30, 50 ]
⚠️ Warning new Array(3) creates 3 empty slots, not [3] — a single numeric argument sets the length. Prefer literals.
💡 Tip Arrays are reference types: const arr = [1]; arr.push(2) is legal. Copy with [...arr] or slice().
🏷️ Related Array Methods
💡 Related Cases
More case studies coming soon — check back later.
📚 Related Tutorials
❓ FAQ
QHow to check for an array?
AArray.isArray(value) is the only reliable way; typeof gives object and instanceof fails across frames.
QCan length be assigned?
AYes: a smaller value truncates (irreversibly); a larger value creates trailing holes.
QDoes method-chain order matter?
AYes — filter then map differs from map then filter; most methods return new arrays.