𝗢𝗯𝗷𝗲𝗰𝘁𝘀 𝗶𝗻 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁

JavaScript objects store related data as key-value pairs. Each key acts as a unique identifier for its value.

Values in an object include:

Objects are mutable. You add, change, or remove properties at any time. This helps you group data and behavior together.

Two ways to create objects:

  1. Object Literals Use curly braces to define properties directly. Example: const user = { name: "Vidhya", age: 23, job: "Developer" };

  2. New Object Constructor Use the Object() constructor. Example: const user = new Object(); user.name = "Alex"; user.age = 4;

How to work with objects:

Always declare your objects with const to keep your references stable.

Source: https://dev.to/vidhya_murali_5aabe7784bd/objects-in-javascript-5600