[DAY 9] Understanding Objects in JavaScript — A Beginner’s Guide
shakambhar pujari
January 8, 2026
medium
Overview
This article serves as a beginner-friendly guide to JavaScript objects. It explores the core concepts of objects, their structure, and their importance in JavaScript programming. The piece aims to equip readers with the foundational knowledge necessary to effectively use objects in their projects.
Key Concepts
- What are Objects? Objects are collections of key-value pairs used to represent real-world entities and store related data.
- Key-Value Pairs: Each piece of data in an object is stored as a key-value pair, where the key is a string and the value can be any data type.
- Dot Notation and Bracket Notation: Values in an object can be accessed and modified using either dot notation (e.g.,
person.name) or bracket notation (e.g.,person["email"]). - Objects vs. Arrays: Objects are used for structured data with keys, while arrays are used for lists of items with index-based storage.
- Adding and Modifying Properties: Properties can be dynamically added, updated, and deleted in objects.
- Objects Can Store Anything: Objects can hold different types of values, including functions (methods) and other objects (nested objects).
Examples
const person = {
name: "John Doe",
age: 30,
email: "john.doe@example.com",
isMarried: false
};
console.log(person.name); // "John Doe"
console.log(person["email"]); // "john.doe@example.com"
const car = { brand: "Toyota", model: "Corolla" };
// Adding a new property
car.year = 2024;
// Modifying an existing property
car.model = "Camry";
// Deleting a property
delete car.brand;
console.log(car); // { model: "Camry", year: 2024 }
const user = {
name: "Alice",
address: {
city: "New York",
country: "USA"
},
greet: function() {
console.log(`Hello, my name is ${this.name}`);
}
};
console.log(user.address.city); // "New York"
user.greet(); // "Hello, my name is Alice"
Key Takeaways
- Objects are fundamental data structures in JavaScript, enabling the organization and manipulation of structured data.
- Understanding key-value pairs, dot notation, and bracket notation is crucial for working with objects.
- Objects offer flexibility by allowing the storage of various data types, including functions and nested objects.
Next Steps
The subsequent article will delve into the inner workings of objects, prototypes, inheritance, class creation, and advanced object methods.
Original Source
This experience was originally published on medium. Support the author by visiting the original post.
Read on medium