In javascript an object is a standalone data structure used to Store collection of related data and more complex entities.Unlink Primitive data types like string or numbers.Store a single Value,object act as containers for multiple values organized as the Key-value pairs.
keys also called as properties (string or symbols)
Object are variables that store both values and function
Values can be anything : numbers,strings,arrays,function,or even Other objects
Object are one of the most important concept in javascript
Object is the mutable and dynamic properties it can be add,modify and delete at any time
Object contains methods and properties
Object are using with curly bracket {}
SYNTAX
const object name={
properties (key-pairs)
}
CRUD operation of object
C-(create)
R-(read)
U-(update)
D-(delete)
- CREATE - Adding data
You can create a new object or new properties
Example:
- name,age - are keys
- mohan,25 - are their values
Output:
{ name: 'mohan', age: 25 }
- READ - Access data
You can read a values using dot notation in the bracket notation
Example:
Output:
mohan
25
- UPDATE - Modify data
You can change the existing values
Example:
Output:
mohan
27
- Delete - Remove data
You can remove properties using the (delete) keyword
Example:
Output:
{ age: 27 }




Top comments (0)