Public, Private and Protected Variables: ========================================= variable_name = value ==> Public type _variableNname = value ==> Private __variableName = value ==> Protected public type of variables can allow to access in any where private type limit to the class only. ( We can access within the same class) protected type can be limit to package Object Property Methods: ======================== 1) Object.defineProperty(): =========================== ==> Object ==> collection of properties. ==> defineProperty() can use to add new property to the existed object. ==> defineProperty() can also use to modify the existing property of object. Syntax: Object.defineProperty(ObjectName, property, description) Here: ObjectName ==> name of the object on which we need to use "defineProperty()". property ==> name of the property(key) must be specify in string format. description ==> value for the specified key ==> We can allow to define attributes for Objects while creating with defineProperty(). 1) value ==> for assigning a value to the given property 2) writable specify: true ==> if the property allowed for modification false==> if the property consider for only reading but not to modify. 3) configurable specify: true false // using defineProperty() for creating the new Object let userProfile = {}; Object.defineProperty(userProfile,'userName',{ value : "Jatin Das", writable : true, configurable : true }); console.log(userProfile); console.log(userProfile.userName); userProfile.userName = "Ashok Jain"; console.log(userProfile.userName); delete userProfile.userName; console.log(userProfile.userName); ================================================= // using defineProperty() for creating the new Object let userProfile = {}; Object.defineProperty(userProfile,'userName',{ value : "Jatin Das", writable : true, configurable : false }); // defining new property let ageValue = 30; Object.defineProperty(userProfile,'age',{ // getter method get(){ console.log("Getting the user age..."); return ageValue; }, // setter method set(newAge){ console.log("Setting the value for user age..."); ageValue = newAge; }, configurable : false }); console.log(userProfile.age); userProfile.age = 31; console.log(userProfile.age); delete userProfile.age; console.log(userProfile.age); ========================================== Object.getOwnPropertyNames(): ============================ ==> return an array with only the property names of an object. Syntax: Object.getOwnPropertyNames(object-name); Object.keys(): ============= ==> return an array with keys of the specified object. Syntax: Object.keys() let person = { firstName : "John", lastName : "Justin", age : 55, eyeColor : "blue" } console.log(person); let properties = Object.getOwnPropertyNames(person); console.log(properties); let keys = Object.keys(person); console.log(keys);