Back to articles
Understanding JavaScript Objects Using CRUD Operations

Understanding JavaScript Objects Using CRUD Operations

via Dev.toAthithya Sivasankarar

Objects are one of the most important concepts in JavaScript. They allow us to store data in key-value pairs. What is an Object? An object is a collection of properties where each property has a key and a value. Example: const user = { name : " Athithya " , age : 20 }; console . log ( user ); Output: { name: "Athithya", age: 20 } CRUD Operations in JavaScript Objects CRUD stands for: Create Read Update Delete 1. Create (Adding Data) We can create an object or add new properties. Example: const user = {}; user . name = " Athithya " ; user . age = 20 ; console . log ( user ); Output: { name: "Athithya", age: 20 } 2. Read (Access Data) We can access object values using dot notation. Example: const user = { name : " Athithya " , age : 20 }; console . log ( user . name ); Output: Athithya 3. Update (Modify Data) We can change existing values. Example: const user = { name : " Athithya " , age : 20 }; user . age = 21 ; console . log ( user . age ); Output: 21 4. Delete (Remove Data) We can re

Continue reading on Dev.to

Opens in a new tab

Read Full Article
2 views

Related Articles