Explanation:

Stores multiple related values in one variable.

Array Properties

length

Returns the total number of elements in the array.

Explanation:

Returns 3 for three elements.

Creating Arrays

Explanation:

Creates an array with numeric values.

Accessing and Updating Elements

Explanation:

Accesses and updates elements using index positions.

Common Array Methods (Reference)

Add / Remove

  • push() → add to end

  • pop() → remove from end

  • shift() → remove from start

  • unshift() → add to start

Search

  • includes() → check if value exists

  • indexOf() → find index

  • lastIndexOf() → find last index

  • find() → find element by condition

  • findIndex() → find index by condition

Iteration / Transformation

  • forEach() → loop through elements

  • map() → create new array

  • filter() → filter elements

  • reduce() → combine values

  • some() → check any match

  • every() → check all match

Sorting / Reordering

  • sort() → sort elements

  • reverse() → reverse array

Extract / Combine

  • slice() → extract portion

  • splice() → add/remove elements

  • concat() → merge arrays

Mutating vs Non-Mutating Methods

Some methods change the original array, others return a new array.

Mutating Methods:
push(), pop(), shift(), unshift(), sort(), splice(), reverse()

Non-Mutating Methods:
map(), filter(), slice(), concat(), includes()

Common Mistakes with Arrays

  • Forgetting that indexes start from 0

  • Mutating arrays unintentionally

  • Using map() when no new array is required

  • Confusing slice() with splice()

Summary of JavaScript Array Reference

CategoryMethods / Properties
Propertylength
Add/Removepush(), pop(), shift(), unshift()
Searchincludes(), indexOf(), find()
IterationforEach(), map(), filter(), reduce()
Sortingsort(), reverse()
Extract/Mergeslice(), splice(), concat()

Conclusion

The JavaScript Array reference provides essential methods and properties to manage collections of data effectively. By understanding how to create arrays, access elements, and use built-in methods for searching, iterating, sorting, and transforming data, array handling becomes simple and powerful in JavaScript applications.