Say we have an array of books, might look like: const library=[ { title: "Ishmael", author: "Daniel Quinn"}, { title: "The BFG", author: "Roald Dahl"} ] Now, if we wanted, we could go: const faveBook=library[1]; console.log(faveBook.author) We have made faveBook a reference to the second ele… Answer from snowmonkey on forum.freecodecamp.org
🌐
W3Schools
w3schools.com › js › js_arrays.asp
JavaScript Arrays
But, JavaScript arrays are best described as arrays. Arrays use numbers to access its "elements". In this example, person[0] returns John: const person = ["John", "Doe", 46]; Try it Yourself » · Objects use names to access its "members".
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array
Array - JavaScript | MDN
February 24, 2026 - The Array object, as with arrays in other programming languages, enables storing a collection of multiple items under a single variable name, and has members for performing common array operations. In JavaScript, arrays aren't primitives but are instead Array objects with the following core ...
Discussions

Accessing an array's object's property, how?
The curriculum covers accessing nest objects, but it presented what they called complex objects wit han exemple of an array containing objects. Now i learned from this forums some answers about accessing object’s array’s entriee it was easy. Now the table has turned, it’s the array that ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
1
0
October 27, 2021
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
Objects vs Arrays
Do you have one thing with multiple properties or do you have multiple things? The answer to this determines which you use. This is a good way to represent a dog (leaving Class aside) const dog = { name: 'Spot', age: 3, speak() { alert('woof'); } } This is a bad way to represent a dog const dog = [ 'Spot', 3, () => alert('woof'), ]; Why? console.log(dog.name); dog.speak(); Is much easier to understand than console.log(dog[0]); dog[2](); Besides just being hard to read, if your array ever goes out of order, all your code will break This is a good way to represent a list of dogs: const doggyDayCare = [ dog1, dog2, dog3, dog4, dog5, ]; This is a bad way to represent a list of dogs: const doggyDayCare = { dog1: dog1, dog2: dog2, dog3: dog3, dog4: dog4, dog5: dog5, } While you can do this, it's a lot harder to sort your dogs, find them, add to them, etc. Lets say I want all puppies const puppies = doggyDayCare.filter(dog => dog.age < 1); This gives me a new array of puppies. Could you do this with an object? Yes, but only by turning it into an array first, filtering down, then reducing back to an object. And it's ugly. const puppies = Object.entries(doggyDayCare) .filter(([key, dog]) => dog.age < 1) .reduce((previous, current) => { const result = { ...previous, }; result[current[0]] = current[1]; return result; }, {}); It is possible, but it is a bad idea. Adding a dog to an array is easy: doggyDayCare.push(newDog); How do you add a dog to an object? You have to make sure there already isn't a property with the same name for the given dog, or you'll replace it. You end up with another bit of ugly code to try to safely add a new property. So, if you have one thing with multiple properties, use an object, if you have multiple things, use an array. More on reddit.com
🌐 r/learnjavascript
29
8
March 10, 2023
[Javascript] The difference between Arrays and Objects?

The point of arrays is that you use them to store multiple items of the same kind. Like, for some computation you have one million data points from a sensor. They go in an array. You then iterate over the array and do some computation on each element, uniformly the same computation for each one.

In an object, the whole object represents one whole thing, which has some number of specific properties that are represented by the members of the object. You use that for something like a person, who has a first name, a last name, a phone number, an email address, and a street address. You don't normally iterate over those different pieces of information to do the same computation on all of them. You might, on the other hand, store a number of persons in an array of person objects, and iterate over them for instance to search for all persons who live on a particular street.

More on reddit.com
🌐 r/learnprogramming
18
17
September 4, 2014
🌐
DEV Community
dev.to › arjun98k › exploring-arrays-and-objects-in-javascript-2049
Exploring Arrays and Objects in JavaScript - DEV Community
December 13, 2024 - Arrays: Use for ordered collections; leverage methods like map, filter, and reduce for powerful transformations. Objects: Use for structured data with key-value pairs; master methods like Object.keys and Object.values.
Find elsewhere
🌐
Reddit
reddit.com › r/learnjavascript › objects vs arrays
r/learnjavascript on Reddit: Objects vs Arrays
March 10, 2023 -

Hello! Just curious…do you guys like manipulating objects or arrays more? Pros and cons of both?

Personally I find dot notation with objects much much easier then iteration but I am a novice and I’m curious to know if my logic is flawed.

Thanks!

Top answer
1 of 5
33
Do you have one thing with multiple properties or do you have multiple things? The answer to this determines which you use. This is a good way to represent a dog (leaving Class aside) const dog = { name: 'Spot', age: 3, speak() { alert('woof'); } } This is a bad way to represent a dog const dog = [ 'Spot', 3, () => alert('woof'), ]; Why? console.log(dog.name); dog.speak(); Is much easier to understand than console.log(dog[0]); dog[2](); Besides just being hard to read, if your array ever goes out of order, all your code will break This is a good way to represent a list of dogs: const doggyDayCare = [ dog1, dog2, dog3, dog4, dog5, ]; This is a bad way to represent a list of dogs: const doggyDayCare = { dog1: dog1, dog2: dog2, dog3: dog3, dog4: dog4, dog5: dog5, } While you can do this, it's a lot harder to sort your dogs, find them, add to them, etc. Lets say I want all puppies const puppies = doggyDayCare.filter(dog => dog.age < 1); This gives me a new array of puppies. Could you do this with an object? Yes, but only by turning it into an array first, filtering down, then reducing back to an object. And it's ugly. const puppies = Object.entries(doggyDayCare) .filter(([key, dog]) => dog.age < 1) .reduce((previous, current) => { const result = { ...previous, }; result[current[0]] = current[1]; return result; }, {}); It is possible, but it is a bad idea. Adding a dog to an array is easy: doggyDayCare.push(newDog); How do you add a dog to an object? You have to make sure there already isn't a property with the same name for the given dog, or you'll replace it. You end up with another bit of ugly code to try to safely add a new property. So, if you have one thing with multiple properties, use an object, if you have multiple things, use an array.
2 of 5
5
when I need objects I use Object when I need an array I use Array. What is this question about? For a nail you need a hammer, for a screw you need... you get the idea...
🌐
CodeBurst
codeburst.io › useful-javascript-array-and-object-methods-6c7971d93230
Useful Javascript Array and Object Methods | by Robert Cooper | codeburst
October 16, 2018 - There are some really cool use cases for .reduce() outlined in the MDN docs that provide examples on how to do things likes flattening an array of arrays, grouping objects by a property, and removing duplicate items in array.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › some
Array.prototype.some() - JavaScript | MDN
February 24, 2026 - A function to execute for each element in the array. It should return a truthy value to indicate the element passes the test, and a falsy value otherwise.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › push
Array.prototype.push() - JavaScript | MDN
Instead, we store the collection on the object itself and use call on Array.prototype.push to trick the method into thinking we are dealing with an array—and it just works, thanks to the way JavaScript allows us to establish the execution context in any way we want.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-access-array-of-objects-in-javascript
How to Access Array of Objects in JavaScript ? - GeeksforGeeks
The filter() method in JavaScript is used to access and create a new array of objects that meet specific criteria.
Published   July 23, 2025
🌐
Reddit
reddit.com › r/learnprogramming › [javascript] the difference between arrays and objects?
r/learnprogramming on Reddit: [Javascript] The difference between Arrays and Objects?
September 4, 2014 -

Hey - I'm working through Code Academy trying to learn Javascript so I can code within Unity.

I've just been introduced to Objects but I don't understand how they differ to arrays... Both hold multiple sets of information and it seems like the only difference is you're able to index Objects with a named category instead of trying to remember that array[1] is this and array[2] is that.

Can someone please shed more light on this for me? Thanks so much!

Top answer
1 of 4
9

The point of arrays is that you use them to store multiple items of the same kind. Like, for some computation you have one million data points from a sensor. They go in an array. You then iterate over the array and do some computation on each element, uniformly the same computation for each one.

In an object, the whole object represents one whole thing, which has some number of specific properties that are represented by the members of the object. You use that for something like a person, who has a first name, a last name, a phone number, an email address, and a street address. You don't normally iterate over those different pieces of information to do the same computation on all of them. You might, on the other hand, store a number of persons in an array of person objects, and iterate over them for instance to search for all persons who live on a particular street.

2 of 4
3

In JavaScript, arrays are objects, where the position of a value in the array (its numerical index) is its key. Seriously, try my_array isInstanceOf Object. They also have a few special extra methods and properties that normal objects don't have, like push and pop, length, indexOf, etc.

Arrays are good for storing sequences of things where the order is important. Let's say you want to represent a line (or queue) of people waiting to buy tickets for a movie. Then you can use an array to store the people's names, and the position in the array will represent their position in line (starting at zero). Like:

var ticket_line = ['alice', 'bob', 'carol', 'dave'];
// A new person shows up in line
ticket_line.push('eve');
// The first person in line gets her ticket
ticket_line.shift(); // 'alice' gets her ticket
ticket_line.length; // Four people in line

You could do this with an object, but... well, don't. Use the right tool for the job. And similarly, you could use non-integer keys in an array (e.g. my_array['four'] = 4; is perfectly valid in JavaScript), but again, don't do this.

More generally though, objects (or associative arrays, dictionaries, etc. as they may be known in other languages) and arrays (or lists) are NOT necessarily going to be so similar in other languages. But they are still going to serve generally the same purpose. Arrays for storing an ordered sequence of values, and objects for storing a key which maps to a value.

🌐
Oreate AI
oreateai.com › blog › understanding-javascript-array-objects-a-comprehensive-guide › a43c70871bc0cbcb7aa29fe5e70309e7
Understanding JavaScript Array Objects: A Comprehensive Guide - Oreate AI Blog
December 24, 2025 - At their core, arrays in JavaScript can hold various types of values—numbers, strings, even other objects—and come equipped with a plethora of methods designed to manipulate these collections seamlessly.
🌐
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.
🌐
LearnersBucket
learnersbucket.com › home › examples › javascript › what is the difference between an array and an object in javascript?
What is the difference between an array and an object in JavaScript? - LearnersBucket
February 3, 2020 - Objects are the most powerful data type of the javascript as they are used in almost everything. Functions are object, Arrays are objects, Regular Expression are objects and of course objects are objects.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-add-an-object-to-an-array-in-javascript
JavaScript- Add an Object to JS Array - GeeksforGeeks
In JavaScript, arrays are used to store multiple values in a single variable, and objects are collections of properties and values.
Published   July 12, 2025
🌐
Codecademy
codecademy.com › forum_questions › 53a7ba31548c351d0c00706a
Object vs Array | Codecademy
It seems like if I wanted to store a list of things in one place, I could use an array or an object. Which ones do you use in which situations? What’s the difference? ... Hi Jack, first of all they are both objects and so are functions, objects. Almost everything in JavaScript is an object.
🌐
Eloquent JavaScript
eloquentjavascript.net › 04_data.html
Data Structures: Objects and Arrays :: Eloquent JavaScript
Most values in JavaScript have properties, with the exceptions being null and undefined. Properties are accessed using value.prop or value["prop"]. Objects tend to use names for their properties and store more or less a fixed set of them. Arrays, on the other hand, usually contain varying amounts of conceptually identical values and use numbers (starting from 0) as the names of their properties.
🌐
JSON
json.org
JSON
An object begins with {left brace and ends with }right brace. Each name is followed by :colon and the name/value pairs are separated by ,comma. An array is an ordered collection of values. An array begins with [left bracket and ends with ]right bracket.