javascript object property list code example
Example 1: javascript list object properties
var person={"first_name":"Bill","last_name":"Jenner"}
var keys = Object.keys(person);
Example 2: javascript list class properties
function getClassProperties(instanceOfClass) {
const proto = Object.getPrototypeOf(instanceOfClass);
const names = Object.getOwnPropertyNames(proto);
return names.filter(name => name != 'constructor');
}
Example 3: show filed of object javascript
var getKeys = function(obj){
var keys = [];
for(var key in obj){
keys.push(key);
}
return keys;
}