To create an array of persons:

var persons = []; // initialize the array

persons.push({firstName:"John", lastName:"Doe", age:46}); // Add an object

persons.push({firstName:"Joanne", lastName:"Doe", age:43}); // Add another object

To retrieve the value at a specific index:

persons[1].firstName // "Joanne"
persons[1].lastName  // "Doe"
persons[1].age       // 43

To iterate through the array use a for loop, or any kind of loop:

for (var i = 0; i < persons.length; i++) {
    console.log( persons[i].firstName ); // writes first names to console
}
Answer from johndoe33 on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_arrays.asp
JavaScript Arrays
You should use objects when you want the element names to be strings (text). You should use arrays when you want the element names to be numbers. JavaScript has a built-in array constructor new Array().
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ JavaScript โ€บ Reference โ€บ Global_Objects โ€บ Array
Array - JavaScript - MDN Web Docs
February 24, 2026 - The array's object properties and list of array elements are separate, and the array's traversal and mutation operations cannot be applied to these named properties. Array elements are object properties in the same way that toString is a property (to be specific, however, toString() is a method). Nevertheless, trying to access an element of an array as follows throws a syntax error because the property name is not valid: ... JavaScript ...
Discussions

How can i list an array of objects in Javascript? - Stack Overflow
2 How do I loop through an array with multiple objects and list certain elements in solely Javascript? More on stackoverflow.com
๐ŸŒ stackoverflow.com
What is the best way to create an array of objects in Javascript? - Stack Overflow
This would be an array of objects. More on stackoverflow.com
๐ŸŒ stackoverflow.com
Array inside a JavaScript Object? - Stack Overflow
I've tried looking to see if this is possible, but I can't find my answer. I'm trying to get the following to work: var defaults = { 'background-color': '#000', color: '#fff', weekdays: {['sun... More on stackoverflow.com
๐ŸŒ stackoverflow.com
creating list of objects in Javascript - Stack Overflow
Is it possible to do create a list of your own objects in Javascript? This is the type of data I want to store : Date : 12/1/2011 Reading : 3 ID : 20055 Date : 13/1/2011 Reading : 5 ID : 20053 Date : 14/1/2011 Reading : 6 ID : 45652 ... List does not works on javascript. It will show "List not defined" error in console. You can try Array... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
daily.dev
daily.dev โ€บ home โ€บ blog โ€บ get into tech โ€บ create array of objects javascript: a beginner's guide
Create Array of Objects JavaScript: A Beginner's Guide
December 22, 2025 - Basics of JavaScript Objects: Objects are like containers with labeled info, making data easy to organize and access. Understanding Arrays: Arrays let you store a list of items, including objects, in a specific order.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ javascript-array-of-objects-tutorial-how-to-create-update-and-loop-through-objects-using-js-array-methods
JavaScript Array of Objects Tutorial โ€“ How to Create, Update, and Loop Through Objects Using JS Array Methods
May 14, 2020 - Array.every and Array.some come handy when we just need to check each object for a specific condition. Do we have a red cabrio in the list of cars? Are all cars capable of transporting at least 4 people?
๐ŸŒ
W3Schools
w3schools.com โ€บ jsref โ€บ jsref_obj_array.asp
JavaScript Array Reference
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST TOOLS ... Array[ ] Array( ) at() concat() constructor copyWithin() entries() every() fill() filter() find() findIndex() findLast() findLastIndex() flat() flatMap() forEach() from() includes() indexOf() isArray() join() keys() lastIndexOf() length map() of() pop() prototype push() reduce() reduceRight() rest (...) reverse() shift() slice() some() sort() splice() spread (...) toReversed() toSorted() toSpliced() toString() unshift() values() valueOf() with() JS Boolean
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-access-array-of-objects-in-javascript
How to Access Array of Objects in JavaScript ? - GeeksforGeeks
This method retrieves the entire object at the specified index. To access specific properties, combine it with dot notation for precision. ... Example: The code below demonstrates how we can use the brackets notation to access the elements of the array of objects.
Published ย  July 23, 2025
Find elsewhere
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ javascript โ€บ javascript_arrays_object.htm
JavaScript - Array
Here is a list of the properties of the Array object along with their description โˆ’
๐ŸŒ
Eloquent JavaScript
eloquentjavascript.net โ€บ 04_data.html
Data Structures: Objects and Arrays :: Eloquent JavaScript
A set of daily log entries can be represented as an array, but the entries do not consist of just a number or a stringโ€”each entry needs to store a list of activities and a Boolean value that indicates whether Jacques turned into a squirrel or not. Ideally, we would like to group these together into a single value and then put those grouped values into an array of log entries. Values of the type object are arbitrary collections of properties.
๐ŸŒ
Pressbooks
ecampusontario.pressbooks.pub โ€บ webdev โ€บ chapter โ€บ arrays-and-objects
JavaScript Arrays and Objects โ€“ Full Stack Web Development for Beginners
Write simple JavaScript programs using arrays, objects, and arrays of objects. Like most programming languages, JavaScript supports an indexed data type (called an array) for storing ordered lists of values.
๐ŸŒ
JavaScript.info
javascript.info โ€บ tutorial โ€บ the javascript language โ€บ data types
Arrays
An array is a special kind of object. The square brackets used to access a property arr[0] actually come from the object syntax. Thatโ€™s essentially the same as obj[key], where arr is the object, while numbers are used as keys.
๐ŸŒ
Mozilla
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ JavaScript โ€บ Guide โ€บ Indexed_collections
Indexed collections - JavaScript - MDN Web Docs - Mozilla
This includes arrays and array-like constructs such as Array objects and TypedArray objects. An array is an ordered list of values that you refer to with a name and an index. For example, consider an array called emp, which contains employees' names indexed by their numerical employee number.
๐ŸŒ
Tutorial Republic
tutorialrepublic.com โ€บ javascript-reference โ€บ javascript-array-object.php
JavaScript Array Properties and Methods - Tutorial Republic
To learn more about Arrays, please check out the JavaScript array chapter. The following table lists the standard properties of the Array object.