Array
ELI5 — The Vibe Check
An array is a list of things in order, like a numbered row of boxes. Box 0 holds the first item, box 1 holds the second, and so on. Arrays are the most basic data structure and almost every program uses them. You can loop over them, sort them, and access any item instantly by its number.
Real Talk
An array is an ordered, indexed collection of elements stored in contiguous memory locations (in low-level languages) or as a dynamic structure (in high-level languages). Arrays provide O(1) random access by index, O(n) search, and O(n) insertion/deletion in the middle. In JavaScript, arrays are dynamic and can hold mixed types. In typed languages, arrays are fixed-type.
Show Me The Code
// JavaScript array operations:
const nums = [10, 20, 30, 40, 50];
console.log(nums[0]); // 10 — index access O(1)
console.log(nums.length); // 5
nums.push(60); // add to end O(1)
nums.unshift(0); // add to start O(n) — shifts all
nums.splice(2, 1); // remove at index O(n)
const doubled = nums.map(n => n * 2); // transform
const evens = nums.filter(n => n % 2 === 0); // filter
When You'll Hear This
"Store the results in an array." / "Loop over the array and process each item."
Related Terms
Data Structure
A data structure is a way of organizing information in your code so it is easy to use and fast to access.
Index
A database index is like the index in the back of a book. Without it, the database reads every single row to find what you want.
Linked List
A linked list is like a treasure hunt where each clue tells you where the next clue is. Each item (node) holds a value AND a pointer to the next item.
Loop
A loop makes your code do something over and over until a condition says stop.
Object
An object is like a labeled container — instead of numbered boxes like an array, each box has a name.