Arrays: Creating, Reading and Changing
Learn Arrays: Creating, Reading and Changing (Phase 3 · Arrays, Strings, Objects (Essential), JavaScript) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Array basics • An array is an ordered, zero-indexed list that can hold any mix of values. length is always one more than the highest index. • Add/remove at the end: push / pop . At the start: unshift / shift (slower, they re-index). • slice(start, end) copies a section without changing the original. splice(start, count, ...items) removes/inserts in place . • Modern accessors: at(-1) reads from the end; includes tests membership; indexOf finds a position.