Interview Question

What are arrays in JavaScript?

Arrays are indexed objects with special length behavior.

💡 Concept ✅ Quick Revision ⚡ JavaScript

Answer

A JavaScript Array is an exotic object specialized for indexed values and a length property. • Array indexes are property keys with special length behavior. • Arrays can contain values of different types. • Array.isArray reliably tests whether a value is an Array.

Example

Code
const items = ['a', 'b'];
items.push('c');
console.log(items.length);
Output
3

Quick Revision

Arrays are indexed objects with special length behavior.