I know a best practice that using Object.keys(your_object). It will parse to array property name for you. Example:
var person = { firstName: 'John', lastName: 'Cena', age: '30' };
var listPropertyNames = Object.keys(person); //["firstName", "lastName", "age"]
I hope this example is useful for you.
More Related Contents:
- Count the recurrence of a word
- the value of the property “if” is null or undefined, not a Function object [closed]
- How do I remove a property from a JavaScript object?
- Dynamically access object property using variable
- Test for existence of nested JavaScript object key
- Sorting object property by values
- Convert JS object to JSON string
- How to create an object property from a variable value in JavaScript? [duplicate]
- Converting an object to a string
- Remove array element based on object property
- What is the difference between string primitives and String objects in JavaScript?
- Is it possible to get the non-enumerable inherited property names of an object?
- How to set object property (of object property of..) given its string name in JavaScript?
- String to object in JS
- Getting the object’s property name
- How to set a Javascript object values dynamically?
- Does console.log invokes toString method of an object?
- Access object properties within object [duplicate]
- Access JavaScript property case-insensitively?
- Watch for object properties changes in JavaScript [duplicate]
- how to access object property using variable [duplicate]
- Can a JavaScript object property refer to another property of the same object? [duplicate]
- How do I access properties of a javascript object if I don’t know the names?
- How to create Javascript constants as properties of objects using const keyword?
- Accessing an object property with a dynamically-computed name
- Why does String.prototype log it’s object like a standard object, while Array.prototype logs it’s object like a standard array?
- How to prevent automatic sort of Object numeric property?
- JavaScript object literal length === undefined?
- Are there limits to the number of properties in a JavaScript object?
- What is the JavaScript equivalent of var_dump or print_r in PHP? [duplicate]