How to read properties of an Object in JavaScript ? Last Updated : 21 Feb, 2022 Comments Improve Suggest changes Like Article Like Report Objects in JavaScript, it is the most important data type and forms the building blocks for modern JavaScript. These objects are quite different from JavaScript’s primitive data-types(Number, String, Boolean, null, undefined, and symbol) in the sense that these primitive data-types all store a single value each (depending on their types). In this article, we will see How can we read the properties of an object in JavaScript. There are different ways to call the properties of objects in Javascript. Dot property accessor: In this, we use a dot property accessor to access the property of the object, the property must be a valid JavaScript identifier. Syntax: ObjectName.propertyName Example: JavaScript <script> var obj={ name : "Mohan Jain", age : 21, address : "Bhopal" }; var name=obj.name; console.log(name); </script> Output: Mohan Jain Using square brackets: In this, we use a square bracket to access the property of the object. It is the same as accessing the elements of an array using the square bracket. Syntax: ObjectName[propertyName] Example: JavaScript <script> var obj={ name : "Mohan Jain", age : 21, address : "Bhopal" }; var name=obj[name]; console.log(name); </script> Output: Mohan Jain Object destructuring: In this, we read a property and assign its value to a variable without duplicating the property name. It is similar to array destructuring except that instead of values being pulled out of an array. The properties (or keys) and their corresponding values can be pulled out from an object. Syntax: var { propertyName } = ObjectName Example: JavaScript <script> var obj={ name : "Mohan Jain", age : 21, address : "Bhopal" }; var { name } = obj; console.log(name); </script> Output: Mohan Jain Accessing the property of Object using jQuery: Make sure you have jquery installed. We can use the jQuery library function to access the properties of Object. jquery.each() method is used to traverse and access the properties of the object. Example: JavaScript <script> const jsdom = require('jsdom'); const dom = new jsdom.JSDOM(""); const jquery = require('jquery')(dom.window); var obj={ name : "Mohan Jain", age : 21, address : "Bhopal" }; jquery.each(obj, function(key, element) { console.log('key: ' + key + ' ' + 'value: ' + element); }); </script> Output: Comment More infoAdvertise with us Next Article How to read properties of an Object in JavaScript ? S sharmaharsh_05 Follow Improve Article Tags : JavaScript Web Technologies Class and Object JavaScript-Questions Similar Reads How to create object properties in JavaScript ? JavaScript is built on an object-oriented framework. An object is a collection of properties, where each property links a key to a value. These properties are not in any specific order. The value of a JavaScript property can be a method (function). Object properties can be updated, modified, added, 4 min read How to add and remove properties from objects in JavaScript ? We will try to understand how to add properties to an object and how to add or remove properties from an object in JavaScript.Before we go and see the addition and removal of properties from an object let us first understand the basics of an object in JavaScript.Object:An object in JavaScript is a c 6 min read How to get a subset of a javascript object's properties? To get the subset of properties of a JavaScript Object, we make use of destructuring and Property Shorthand. The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.Syntax: subset = (({a, 2 min read How to Pass Object as Parameter in JavaScript ? We'll see how to Pass an object as a Parameter in JavaScript. We can pass objects as parameters to functions just like we do with any other data type. passing objects as parameters to functions allows us to manipulate their properties within the function. These are the following approaches: Table of 3 min read How to print the content of an object in JavaScript ? To print the content of an object in JavaScript we will use JavaScript methods like stringify, object.values and loops to display the required data. Let's first create a JavaScript Object containing some key-values as given below: JavaScript // Given Object const obj = { name: 'John', age: 30, city: 3 min read How to get property descriptors of an object in JavaScript ? Here, we are going to discuss the property descriptors of an Object in JavaScript. The Object.getOwnPropertyDescriptor() method returns an object describing a specific property on a given object. A JavaScript object can be created in many ways and its properties can be called by using property descr 2 min read How to Remove a Property From JavaScript Object? The delete operator is used to remove a property from a JavaScript object. The delete operator allows you to remove a specified property from an object. Once a property is deleted, it no longer exists in the object.Using delete OperatorThe basic method to remove a property from a JavaScript object i 3 min read How to Traverse Array of Objects and Access the Properties in JavaScript? Here are the various methods to traverse an array of objects and access the properties in JavaScript1. Using forâ¦in loopThe for...in loop is used to iterate over the enumerable properties of an object. JavaScriptconst a = [ {name: 'Saritha', sub: 'Maths'}, {name: 'Sarthak', sub: 'Science'}, {name: ' 4 min read How to get the size of a JavaScript object ? In this article, we will see the methods to find the size of a JavaScript object. These are the following ways to solve the problem: Table of Content Using Object.keys() methodUsing Object.objsize() methodUsing Object.entries() methodUsing Object.values() methodUsing Object.keys() methodWe can get t 2 min read How to Perform CRUD Operations on JavaScript Object ? This article will demonstrate the CRUD Operations on a JavaScript Object. The operations are Create, Read, Update, and Delete. With these operations, we can create, take input, manipulate & destroy the objects. JavaScript Objects are a collection of keys, values or properties/attributes, and ent 4 min read Like