Object Creation using create(): ============================== Syntax: Object.create() const Vehicle = { type : 'Vehicle', startEngine: function(){ console.log('Engine Started!'); }, stopEngine: function(){ console.log("Engine Stopped!"); } }; console.log(Vehicle.type) const Car = Object.create(Vehicle); Car.type = "Car"; // existing property Car.numWheels = 4; // new property Car.drive = function(){ console.log("Driving the car in autmatic mode..."); } console.log(Car); Car.drive(); Car.startEngine(); Car.stopEngine(); ======================================================= Accessing Object Properties: ============================ 1) using . operator: ==================== Syntax: Object-name.property-name 2) using []: =========== Syntax: Object-name['property-name'] 3) using Iterators: ==================== for in: ====== ==> used to access the property names from the given object. Syntax: for(var obj in Object-name){ //logic } for of: ====== ==> not possible to access values const Employee = { name : "Jatin", type : "Full-time", shift : "ganeral-shift", salary : 67785.0, project:[ {client:"Samsung",domain:"Telecom",location:"Bangalore"}, {chipset:"Quad2553",product:"Qualcom"} ] } // Access the object properties console.log(Employee.name); console.log(Employee.type); console.log(Employee.shift); console.log(Employee.salary); //using [] console.log(Employee['name']); console.log(Employee['type']); console.log(Employee['shift']); console.log(Employee['salary']); // for in iterator for(let obj in Employee){ console.log(obj); } ======================================== // Ecommerce Order const order = { orderId : 12345, customer: { name : "Manikanta", email : "mani1122@gmail.com", address : "1-1-11, XYZ Stree, USA" }, items : [{name:"Laptop",price:39999.0,quantity:1},{name:"Mouse", price: 2000.0,quantity:2}, {name:"Hoody", price: 1999,quantity:3}], isPaid : true } order.items.forEach(item=>{ console.log(`Item:${item.name}, Price:${item.price} and Quantity:${item.quantity}`); }); ===================================== ADDING NEW PROPERTIES INTO AN OBJECT: ===================================== Syntax: Object-name.newPropertyName = value; DELETING PROPERTIES FROM OBJECT =============================== Syntax: delete objectName.PropertyName; OBJECT PROPERTY MODIFICATION: ============================== Syntax: Object-name.propertyName = new-value; const Student = { name : "Rakesh", age : 17 } // modify property value console.log(Student) Student.name = "Kalyan"; Student.age = 18; console.log(Student); // adding new properties Student.roll = 10; Student.subject = "Maths"; console.log(Student) // deleting the object property delete Student.age; console.log(Student);