JavaScript Object.keys() method
Reading object properties using Object.keys() method
by shravan
JavaScript
var person = {
firstName: "Shravan Kumar",
lastName: "Kasagoni",
printName: function () {
console.log(this.firstName + " " + this.lastName);
}
};
var properties = Object.keys(person);
var i, len = properties.length;
for (i = 0; i < len; i++) {
console.log("Property Name: " + properties[i] + ", Property Value: " + person[properties[i]]);
}