js get object property code example
Example 1: javascript dynamically access object property
var person ={"first_name":"Billy","last_name":"Riley"};
var property_name="first_name";
alert(person[property_name]);
Example 2: javascript get values from object
Object.values(data)
Example 3: javascript list object properties
var person={"first_name":"Bill","last_name":"Jenner"}
var keys = Object.keys(person);
Example 4: javascript list class properties
function getClassProperties(instanceOfClass) {
const proto = Object.getPrototypeOf(instanceOfClass);
const names = Object.getOwnPropertyNames(proto);
return names.filter(name => name != 'constructor');
}